File: /www/wwwroot/vietktv.vn/wp-content/themes/binhvu/home.php
<?php get_header(); ?>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 hidden-xs"></div>
<div class="col-md-9 col-xs-12 break-col">
<section id="slider">
<div class="main-banner owl-carousel owl-theme">
<?php if ( have_rows( 'list_slide', 'options' ) ) : ?>
<?php while ( have_rows( 'list_slide', 'options' ) ) :
the_row(); ?>
<div class="item">
<a href="<?php the_sub_field( 'link', 'options' ) ?>">
<img src="<?php echo esc_url( get_sub_field( 'hinh_anh', 'options' ) ); ?>" alt="Ảnh 2">
</a>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>
</section>
</div>
</div>
</div>
<section id="best-sell-product">
<div class="container-fluid">
<div class="title-section">
<h3>Sản phẩm bán chạy</h3>
<span class="pull-right">
<ul class="nav panel-tabs">
<?php
$get_category = get_field('chon_dm_spbanchay','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
),
),
);
$query_acts = new WP_Query( $acts );
?>
<?php if($query_acts->have_posts()):?>
<li>
<a href="#<?php echo $term->term_id;?>" data-toggle="tab" aria-expanded="false"><?php echo $name;?></a>
</li>
<?php endif;?>
<?php } ?>
</ul>
</span>
</div>
<div class="tab-content">
<?php
$get_category = get_field('chon_dm_spbanchay','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'=>10,
);
$query_acts = new WP_Query( $acts );
?>
<?php if($query_acts->have_posts()):?>
<div class="tab-pane" id="<?php echo $term->term_id;?>">
<div class="best_sell_carousel owl-carousel owl-theme">
<?php if($query_acts->have_posts()):?>
<?php while ($query_acts->have_posts()) : $query_acts->the_post();?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile; wp_reset_postdata();?>
<?php endif;?>
</div>
</div>
<?php endif;?>
<?php } ?>
</div>
</div>
</section>
<?php
$get_category = get_field('chon_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'=>10,
);
$query_acts = new WP_Query( $acts );
?>
<?php if($query_acts->have_posts()):?>
<section id="product-list-cat">
<div class="container-fluid">
<div class="list-cat">
<div class="title-section">
<h3><a href="<?php echo get_term_link($term->term_id);?>"><?php echo $name;?></a></h3>
</div>
<div class="product-list owl-carousel owl-theme">
<?php if($query_acts->have_posts()):?>
<?php while ($query_acts->have_posts()) : $query_acts->the_post();?>
<?php wc_get_template_part( 'content', 'product' ); ?>
<?php endwhile; wp_reset_postdata();?>
<?php endif;?>
</div>
</div>
</div>
</section>
<?php endif;?>
<?php } ?>
<?php get_footer(); ?>