Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. <!-- tab area start -->
  2.  
  3. <div class="row">
  4. <div class="col-xl-12">
  5. <div class="tanry-shops-tab-menu">
  6. <!-- Nav tabs -->
  7. <ul class="nav">
  8.  
  9. <?php $all_terms = get_terms(array(
  10. 'taxonomy' => 'product', //custom post category taxonomy
  11. 'hide_empty'=> false, //empty custom category false
  12. ));
  13.  
  14. $x = 0;
  15.  
  16. foreach($all_terms as $single_term){
  17.  
  18. $active = '';
  19. if($x == 0){
  20. $active = 'active';
  21. }
  22.  
  23. echo '<li class="nav-item"> <a class="nav-link '. $active .'" data-toggle="tab" href="#'. $single_term->slug .'">'.$single_term->name .'</a></li>';
  24.  
  25. $x++; }
  26. ?>
  27. </ul>
  28. </div>
  29. </div>
  30.  
  31.  
  32. <div class="col-xl-12">
  33. <div class="tanry-shops-tab-panel">
  34. <!-- Tab panes -->
  35. <div class="tab-content">
  36.  
  37. <?php
  38.  
  39. $x = 0;
  40.  
  41. foreach($all_terms as $single){
  42.  
  43. $active = '';
  44. if($x == 0){
  45. $active = 'active';
  46. }
  47.  
  48. ?>
  49.  
  50. <div id="<?php echo $single->slug; ?>" class="tab-pane <?php echo $active; ?>"><br>
  51. <div class="row">
  52. <?php
  53. $tab_product = new WP_Query(array(
  54.  
  55. 'post_type' => 'shop-product',
  56. 'posts_per_page' => -1,
  57. 'product' => $single->slug //category auto slug
  58.  
  59. ));
  60.  
  61. if($tab_product->have_posts()){
  62. while($tab_product->have_posts()){
  63.  
  64. $tab_product->the_post(); ?>
  65.  
  66. <div class="col-xl-3 col-md-6">
  67. <div class="tanry-shops-tab-single-thumb">
  68. <?php the_post_thumbnail(); ?>
  69. </div>
  70. </div>
  71.  
  72.  
  73. <?php } wp_reset_postdata(); // while loop reset
  74. }
  75. ?>
  76.  
  77.  
  78.  
  79. </div>
  80. </div>
  81.  
  82. <?php $x++; }
  83.  
  84. ?>
  85.  
  86. </div>
  87. </div>
  88. </div>
  89. </div>
  90. <!-- tab area -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement