Advertisement
imranmodel32

dynamic isotope

Feb 2nd, 2014
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. // unlink category function
  2. function the_category_unlinked($separator = ' ') {
  3. $categories = (array) get_the_category();
  4.  
  5. $thelist = '';
  6. foreach($categories as $category) { // concate
  7. $thelist .= $separator . $category->category_nicename;
  8. }
  9.  
  10. echo $thelist;
  11. }
  12.  
  13.  
  14.  
  15.  
  16. // isotope filter menu in wp
  17.  
  18. <div class="portfolioFilter">
  19. <?php
  20. $terms = get_terms('category');
  21. $count = count($terms);
  22. if ( $count > 0 ){
  23. echo '<div class="the_filter"> <ul id="portfolioFilter" class="clearfix slimmenu">';
  24. echo '<li><a href="#" data-filter="*">All</a></li>';
  25. foreach ( $terms as $term ) {
  26. $termname = strtolower($term->name);
  27. $termname = str_replace(' ', '-', $termname);
  28. if ($termname=="ux"):
  29. echo '<li><a href="#" data-filter="' . '.' . $termname . '" class="active">' . $term->name . '</a></li>';
  30. else:
  31. echo '<li><a href="#" data-filter="' . '.' . $termname . '">' . $term->name . '</a></li>';
  32. endif;
  33. }
  34. echo '</ul> </div>';
  35. }
  36. ?>
  37. </div><!--portfolioContainer-->
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46. // template code with bootstrap 3
  47. <div class="isotome_area">
  48.  
  49. <div class="portfolioFilter">
  50. <?php
  51.  
  52. $terms = get_terms('category');
  53. $count = count($terms);
  54. if ( $count > 0 ){
  55. echo '<div class="the_filter"> <ul id="portfolioFilter" class="clearfix">';
  56. echo '<li><a href="#" data-filter="*">All</a></li>';
  57. foreach ( $terms as $term ) {
  58. $termname = strtolower($term->name);
  59. $termname = str_replace(' ', '-', $termname);
  60. if ($termname=="ux"):
  61. echo '<li><a href="#" data-filter="' . '.' . $termname . '" class="active">' . $term->name . '</a></li>';
  62. else:
  63. echo '<li><a href="#" data-filter="' . '.' . $termname . '">' . $term->name . '</a></li>';
  64. endif;
  65. }
  66. echo '</ul> </div>';
  67. }
  68. ?>
  69. </div>
  70.  
  71. <div class="row portfolioContainer">
  72.  
  73. <?php
  74.  
  75. $temp = $wp_query;
  76. $wp_query = null;
  77. $wp_query = new WP_Query();
  78. $wp_query->query('showposts=-1&post_type=post'.'&paged='.$paged);
  79. while ($wp_query->have_posts()) : $wp_query->the_post();
  80. ?>
  81.  
  82. <!-- LOOP: Usual Post Template Stuff Here-->
  83. <div id="inner_area" class="food col-xs-12 col-sm-12 col-md-4 col-lg-4 <?php the_category_unlinked(' '); ?>">
  84. <?php the_post_thumbnail();?>
  85. </div>
  86. <!-- LOOP: Usual Post Template Stuff Here-->
  87.  
  88.  
  89. <?php endwhile; ?>
  90.  
  91. <?php
  92. $wp_query = null;
  93. $wp_query = $temp; // Reset
  94. ?>
  95.  
  96.  
  97.  
  98. <!-- post query from a category id-->
  99.  
  100. </div>
  101. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement