File: /www/wwwroot/vietktv.vn/wp-content/themes/binhvu.off/home.php
<?php get_header(); ?>
<div id="home-tmp" class="site-main-wrapper">
<div class="home-slide">
<div class="container">
<?php echo do_shortcode('[smartslider3 slider=2]');?>
</div>
</div>
<div class="section-content">
<div class="container">
<div class="row row-collapse row-collapse1">
<div class="col col-xs-12 col-sm-4 col-md-3 main-sidebar">
<?php get_sidebar();?>
</div>
<div class="col-xs-12 col-sm-8 col-md-9 main content">
<main class="site-main" >
<section class="home-block block-1">
<div class="row">
<div class="title">
sản phẩm mới
</div>
<?php
$args=array('post_type'=> 'product','posts_per_page' =>8);
$the_query = new WP_Query( $args );?>
<?php if ( $the_query->have_posts() ) :?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post();?>
<div class="product-layout col-lg-3 col-md-3 col-sm-6 col-xs-12">
<?php wc_get_template_part( 'content', 'product' ); ?>
</div>
<?php endwhile;?>
<?php endif; wp_reset_postdata();?>
</div>
</section>
<section class="home-block block-2">
<?php
$get_category = get_field('hien-thi-dmsp','option');
foreach ($get_category as $list_cate) {
$term = get_term_by('id',$list_cate,'product_cat');
$slug = $term->slug;
$name = $term->name; ?>
<?php
$acts = array(
'post_type'=>'product',
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => $slug,
'include_children' => true
),
),
'showposts'=>20,
);
$query_acts = new WP_Query( $acts );
?>
<?php if($query_acts->have_posts()):?>
<div class="title-product">
<div class=" padLeftNo padRightNo">
<div class="title">
<a href="<?php echo get_term_link($term->term_id); ?>"><?php echo $name;?></a>
</div>
</div>
</div>
<?php if($query_acts->have_posts()):?>
<div class="row">
<div class="col-xs-12 col-sm-12">
<?php while ($query_acts->have_posts()) : $query_acts->the_post();?>
<div class="product">
<?php wc_get_template_part( 'content', 'product' ); ?>
</div>
<?php endwhile; wp_reset_postdata();?>
</div>
</div>
<?php endif;?>
<?php endif;?>
<?php } ?>
</section>
</main>
</div>
</div>
</div>
</div>
</div>
<?php get_footer(); ?>
<?php/*
if website has sidebar left
col-xs-12 col-sm-12 col-md-8 col-md-push-4 col-lg-push-3 col-lg-9 main content
col-xs-12 col-sm-12 col-md-4 col-md-pull-8 col-lg-pull-9 col-lg-3 sidebar
*/?>