Advertisement
salmancreation

isotop portfolio dynamic - wp

May 21st, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <div class="mix-item-menu text-center">
  2. <?php
  3.     $all_cats = get_terms('portfolio_cat');
  4.     if ( !empty($all_cats) && ! is_wp_error($all_cats) ) {
  5.         $cats = $all_cats;
  6.     }
  7.     foreach ($cats as $cat) :
  8. ?>
  9. <button data-filter=".<?php echo $cat->slug; ?>" class=""><?php echo $cat->name; ?></button>
  10. <?php endforeach; ?>
  11. </div>
  12.    
  13. ----------------------------------
  14.  
  15. <?php
  16.  
  17. $project_cats = get_the_terms( get_the_ID(), 'portfolio_cat' );
  18.                          
  19. if ( $project_cats && ! is_wp_error( $project_cats ) ) {
  20.  
  21.     $project_cat_list = array();
  22.  
  23.     foreach ( $project_cats as $cat ) {
  24.         $project_cat_list[] = $cat->name;
  25.     }
  26.                          
  27.     $project_all_cats = join( " ", $project_cat_list);
  28.  }
  29. else {
  30. $project_all_cats = '';
  31. }  
  32.  
  33. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement