I’m trying to add an Icon List to the WooCommerce shop category descriptions. I found a post with some instructions for another theme (https://kriesi.at/support/topic/shortcodes-not-working-in-product-short-description-area/), but /config-woocommerce/config.php must have changed considerably since then. I’ve tried adding filters, but they don’t seem to be executed, so I need some guidance on how to get this to work. The top of the page I’m working on has the icon lists the way I want, but not in WooCommerce, and the bottom of the page contains a [product_categories] shortcode which is spitting out the shortcodes from the category descriptions without evaluation.
Thanks!
Hey Lissasan,
Thank you for using Enfold.
How did you manage to display the product category description? Did you edit any files? The description should not be displaying by default.
Best regards,
Ismael
Hi Ismael,
Yes, I added the code described on this page at StackOverflow (https://stackoverflow.com/questions/46885808/file-wc-template-functions-php-in-child-theme), plus my modification to print out the description under the <h2> element, which is the item count for the category. The code is echo $category->description
inside paragraph tags.
I added this to my child theme functions.php file.
Hi,
Please try to replace:
echo $category->description
with:
echo do_shortcode($category->description);
to execute shortcodes which are embedded in the description text.
Reference: https://developer.wordpress.org/reference/functions/do_shortcode/
Best regards,
Dude
This worked! Thank you so much! This can be marked as resolved.
Hi,
Great, glad it works now :)
Best regards,
Dude