Last active
July 9, 2021 14:38
-
-
Save Prroffessorr/60a3f4913f7d5111d322994a996a45ed to your computer and use it in GitHub Desktop.
Получение категории товара на странице магазина файл(archive-product.php)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $terms_post = get_the_terms( $the_query->ID , 'product_cat' ); ?> | |
<div> | |
<?php echo _e( 'Category', 'woocommerce' ) ?>: <?php | |
$iterator=1; | |
foreach ($terms_post as $term_cat): echo $term_cat->name; | |
if(count($terms_post)>1 && $iterator<count($terms_post)): | |
echo ", "; | |
endif; $iterator++; | |
endforeach; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment