How to add text below WooCommerce category thumbnails

This is how to add text below WooCommerce category thumbnails in the Product category pages. And not just a line or two, but several paragraphs of text. The ultimate aim is to overcome the ‘thin content’ on category pages.

To illustrate, here is the navigation menu on a WooCommerce site. I wanted to put content in the Greeting Cards category page, in the Occasions and Ranges category pages, and in all the sub-category pages.

As a side note, I already posted this article – ‘Non Clickable Menu Items‘ – about stopping visitors clicking on and seeing the main category pages. That solves the problem of what visitors see, but it only stops the main category pages from being clicked on. It doesn’t hide the pages themselves and it doesn’t stop Google crawling them and seeing thin content.

I don’t want to display the additional content above the thumbnails

I knew that I could display text above the product thumbnails on the category page by entering it in the Description field for the Product category.

By the way, there is a note below the Description field that says “The description is not prominent by default; however, some themes may show it.” That’s a note from WordPress, so any webmaster who goes into the back end to add that note sees it.

I am using Generate Press theme, and text I enter into the Description field does show on the front end. So I could add text into the Description field and it would show on the front end.

However, it is not suitable for displaying several paragraphs because it pushes the product thumbnails down the page.

And I don’t want visitors who are looking for product images to. have to scroll down past two or three paragraphs of text to get to the images.

I worked out that the hook that I wanted to hook into was woocommerce_after_shop_loop. And after some investigation I thought that Advanced Custom Fields would work to add an additional WYSIWYG editor to the product category.

Using Advanced Custom Fields to add a text field

So I created a field group with ACF with Show this field if the taxonomy is equal to Category (product_cat) and it is showed up in the right place. in the back end. But that didn’t mean it would display on the front end. That needed a snippet of code.

From a post on Contadodigital I worked out what code to use to add an action into the ‘woocommerce_after_shop_loop’ hook

function action_woocommerce_after_shop_loop() {
$term_id = get_queried_object()->term_id;
$post_id = 'product_cat_'.$term_id;
$custom_field = get_field('description_below_product_category_thumbnails', $post_id); // My Advanced Custom Field Variable
echo $custom_field;
add_action( 'woocommerce_after_shop_loop', 'action_woocommerce_after_shop_loop', 10, 2 );

Yoast doesn’t recognise the additional text

I have the Yoast SEO and the Yoast WooCommerce plugins installed. They cannot see the additional text. What I needed was something to bridge the gap, and that is what the ACF Content Analysis for Yoast SEO plugin does. It ensures that Yoast SEO analyzes all ACF content including Flexible Content and Repeaters.

The plugin is a cooperation between the people at AngryCreative and Team Yoast, so that seemed like a good bet for reliability.

And that is it.