Advertisement
delvinkrasniqi

Custom Posti

Mar 27th, 2020
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. <div class="galerie">
  2. <div class="container-fluid tz-gallery p-0">
  3.  
  4. <?php
  5. $args = array(
  6. 'post_type' => 'gallery',
  7. 'taxonomy' => 'tagsu',
  8. 'orderby' => 'ID',
  9. 'order' => 'ASC',
  10. 'hide_empty' => 1,
  11. );
  12. $cats = get_categories($args);
  13. ?>
  14. <ul class="nav nav-tabs ultab " id="left_column_date_search" style="justify-content: center ">
  15. <?php
  16. $counter = 0;
  17. foreach($cats as $cat):
  18. // var_dump($cats);
  19. ?>
  20. <li class="nav-item">
  21.  
  22. <a class="nav-link menu-style <?= $counter == 0 ? 'active' : '' ;?>" id="<?= $cat->slug;?>"
  23. data-toggle="tab" href="#post-<?= $cat->slug;?>">
  24. <?php echo $cat->slug ;?>
  25. </a>
  26. </li>
  27. <?php $counter++;
  28. endforeach;
  29. wp_reset_query();?>
  30. </ul>
  31.  
  32. <?php
  33. $args = array(
  34. 'taxonomy' => 'tagsu',
  35. 'orderby' => 'ID',
  36. 'order' => 'ASC',
  37. 'hide_empty' => 1,
  38. );
  39. $cats = get_categories($args);
  40. ?>
  41. <div class="tab-content">
  42. <?php
  43. $counter = 0;
  44. foreach($cats as $cat):
  45. ?>
  46. <div role="tabpanel" class="tab-pane <?=$counter == 0 ? 'active show' : '';?>" id="post-<?= $cat->slug; ?>">
  47. <div class="row m-0">
  48. <?php
  49. $args1 = array(
  50. 'posts_per_page' => -1,
  51. 'tax_query' => array(
  52. array(
  53. 'taxonomy' => 'tagsu',
  54. 'field' => 'slug',
  55. 'terms' => $cat->slug
  56. )
  57. ),
  58. 'post_type' => 'gallery',
  59. 'orderby' => 'title',
  60. 'order' => 'ASC',
  61. );
  62. $wp_query = new WP_Query($args1);
  63. while($wp_query->have_posts()): $wp_query->the_post();
  64. ?>
  65.  
  66. <div class="col-lg-3 col-md-4 col-sm-6 col-12 p-0">
  67. <div class="single-image">
  68. <a href="<?php the_post_thumbnail_url();?>" class="lightbox">
  69. <?php the_post_thumbnail();?>
  70. </a>
  71. </div>
  72. </div>
  73.  
  74. <?php
  75. $counter++;
  76. endwhile;
  77. wp_reset_postdata(); ?>
  78. </div>
  79. </div>
  80. <?php endforeach;
  81. wp_reset_query();?>
  82.  
  83.  
  84. </div>
  85. </div>
  86. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement