Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- tab area start -->
- <div class="row">
- <div class="col-xl-12">
- <div class="tanry-shops-tab-menu">
- <!-- Nav tabs -->
- <ul class="nav">
- <?php $all_terms = get_terms(array(
- 'taxonomy' => 'product', //custom post category taxonomy
- 'hide_empty'=> false, //empty custom category false
- ));
- $x = 0;
- foreach($all_terms as $single_term){
- $active = '';
- if($x == 0){
- $active = 'active';
- }
- echo '<li class="nav-item"> <a class="nav-link '. $active .'" data-toggle="tab" href="#'. $single_term->slug .'">'.$single_term->name .'</a></li>';
- $x++; }
- ?>
- </ul>
- </div>
- </div>
- <div class="col-xl-12">
- <div class="tanry-shops-tab-panel">
- <!-- Tab panes -->
- <div class="tab-content">
- <?php
- $x = 0;
- foreach($all_terms as $single){
- $active = '';
- if($x == 0){
- $active = 'active';
- }
- ?>
- <div id="<?php echo $single->slug; ?>" class="tab-pane <?php echo $active; ?>"><br>
- <div class="row">
- <?php
- $tab_product = new WP_Query(array(
- 'post_type' => 'shop-product',
- 'posts_per_page' => -1,
- 'product' => $single->slug //category auto slug
- ));
- if($tab_product->have_posts()){
- while($tab_product->have_posts()){
- $tab_product->the_post(); ?>
- <div class="col-xl-3 col-md-6">
- <div class="tanry-shops-tab-single-thumb">
- <?php the_post_thumbnail(); ?>
- </div>
- </div>
- <?php } wp_reset_postdata(); // while loop reset
- }
- ?>
- </div>
- </div>
- <?php $x++; }
- ?>
- </div>
- </div>
- </div>
- </div>
- <!-- tab area -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement