I have the regular wordpress code to display category description:
<?php echo category_description( $category_id ); ?>
But how can i display Woocommerce category description? @@ After one of the comment suggestion i added:
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
global $post, $product; $categ = $product->get_categories(); $term = get_term_by ( 'name' , strip_tags($categ), 'product_cat' ); echo $term->description;
} // end while
} // end if
?>
Still, not work.
$args = array( 'taxonomy' => 'product_cat' );
$terms = get_terms('product_cat', $args);
$count = count($terms);
if ($count > 0) {
foreach ($terms as $term) {
echo $term->description;
}
}
Edit for Last answer:
<?php
global $post;
$args = array(
'taxonomy' => 'product_cat'
);
$terms = wp_get_post_terms($post->ID, 'product_cat', $args);
$count = count($terms);
if ($count > 0) {
foreach ($terms as $term) {
echo '<div style="direction:rtl;">';
echo $term->description;
echo '</div>';
}
}
You can display the product category description -
use this code -
<?php global $post, $product;
$categ = $product->get_categories();
$term = get_term_by ( 'name' , strip_tags($categ), 'product_cat' );
echo $term->description; ?>
the_archive_description()
worked for my purposes when other (more complicated) solutions would not.
Optional before and after string parameters can be added if needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With