I had this query:
$args=array(
'post_type' => array('product'),
'order' => 'DESC',
'orderby' => 'rand',
'showposts' => 24
);
query_posts( $args );
if(have_posts()) : while(have_posts()) : the_post();
?>
<div class="col-xs-12 col-s-6 col-sm-4 col-md-3 our-products">
<a class="products-img" href="<?php the_permalink();?>"><?php if ( has_post_thumbnail() ) {the_post_thumbnail('product-size',array('class' => 'img-responsive'));}?></a>
<a class="products-tit" href="<?php the_permalink();?>">
<h2><b><?php the_title();?></b></h2>
</a>
</div>
<?php
endwhile; endif;
wp_reset_query();
?>
I need to get tax term of product belong to it.
Example:
I had Category: Products -> Men fashion/Women fashion -> T-shirt -> product A.
How can i get the term of T-shirt which product A belong to it?
You can use WordPress get_the_terms() function for this purpose.
Here is the example:
In “Your Taxonomy” you put the name of the taxonomy that you just registered e.g.
product-category
So just like this:
And then
This function get_term_link() is use for term link.
Hope this will help you.