Dear Kuldeep,
The code that is given in the post. Where do I have to paste it?
@hamzaa1995 In your theme’s functions.php file. Here is how you can access it: https://www.pair.com/support/kb/how-to-access-your-wordpress-functions-php-file/
Let me know how that goes 🙂
an error is occurred when i am putting this code
<?php
global $post;
$args = array( 'taxonomy' => 'product_cat');
$terms = get_the_terms($category->slug,'product_cat', $args);
$count = count($terms);
if ($count > 0) {
foreach ($terms as $term) {
echo '<div style="direction:rtl;">';
echo $term->description;
echo '</div>';
}
}
?>
to function.php file
the error is
syntax error, unexpected ‘<‘, expecting end of file
@hamzaa1995 You need to close your php tag at the top of your functions.php file or remove the <?php.
@soberbanda code pasted successfully but the issue still not resolved. description not showing on category pages
@hamzaa1995 Try with other solutions given in the Stack Overflow forum. I would recommend this one:
function xyz ($category) {
$cat_id = $category->term_id;
$prod_term = get_term($cat_id,'product_cat');
echo "<div class='designercatname'>".get_field('designer_name', $prod_term )."</div>";
}
Let me know 🙂
@soberbanda this is not working as well :(. I have tried other solutions and they are also not working