
I currently want to create a related product under product_cat. However, I encountered some problems with field taxonomy. Can anybody help me?
<div class="vnkings_category_product">
<div class="head_vnkings">
<h3 class="title_head"><a href="<?php echo get_term_link(16); ?>"><?php echo get_cat_name(16);?></a></h3>
</div>
<?php
$vnkings = new WP_Query(array(
'post_type'=>'product',
'post_status'=>'publish',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => '16'
)
),
'orderby' => 'ID',
'order' => 'DESC',
'posts_per_page'=> '4'));
?>
<?php while ($vnkings->have_posts()) : $vnkings->the_post(); ?>
<div class="list_sp col-md-3">
<a class="image_sp" href="<?php the_permalink() ;?>"><?php the_post_thumbnail("medium",array( "title" => get_the_title(),"alt" => get_the_title() ));?></a>
<h4 class="title_sp"><a href="<?php the_permalink() ;?>"><?php the_title() ;?></a></h4>
<span class="price"><ins><span class="amount">Giá: <?php echo get_post_meta( get_the_ID(), '_regular_price', true ); ?></span></ins></span>
</div>
<?ph
At the 'terms' => '16'
subsidence changes with $ terms, but I don’t know how to do it properly. Thks so much