Advertisement
wdtobibur

Portfolio Dynamic

Oct 11th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.09 KB | None | 0 0
  1.         <?php
  2.  
  3.             $gallery_items = get_terms('gallery_cats_iteams');
  4.             if(!empty($gallery_items) && ! is_wp_error($gallery_items)):
  5.         ?>
  6.         <div class="row">
  7.             <!--Portfolio Filter-->
  8.             <div class="col-md-12 portfolio-filter text-center">
  9.                 <ul>
  10.                     <li class="active" data-filter="*">All</li>
  11.                     <?php foreach( $gallery_items  as $gallery_item): ?>
  12.                         <li data-filter=".<?php echo $gallery_item->slug ?>"><?php echo $gallery_item->name ?></li>
  13.                     <?php endforeach; ?>
  14.                 </ul>
  15.             </div>
  16.         </div>
  17.         <?php endif; ?>
  18.         <!--Portfolio Items-->
  19.         <div  id="lightgallery" class="row portfolio-items mb-50">
  20.               <?php
  21.                     $cv_gallery_item=new WP_Query(array(
  22.                         'post_type' => 'cv_gallery',
  23.                         'posts_per_page' =>-1,
  24.                     ));
  25.                     while($cv_gallery_item->have_posts()) : $cv_gallery_item->the_post();
  26.                         $image_link = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'large' );
  27.                             $cv_gallery = get_the_terms($post->ID,'gallery_cats_iteams');
  28.                             if($cv_gallery && !is_wp_error($cv_gallery)):
  29.                             $cv_gallery_cat_slug = array();
  30.                             foreach($cv_gallery as $cv_gallery_iteam){
  31.                                 $cv_gallery_cat_slug [] =$cv_gallery_iteam->slug;
  32.                                
  33.                             }
  34.                             $cv_gallery_cat_array =join(", ", $cv_gallery_cat_slug);
  35.                             $cv_gallery_class_array =join(" ", $cv_gallery_cat_slug);
  36.                             endif;
  37.                       ?>
  38.  
  39.             <!--Portfolio Item-->
  40.             <div class="item col-lg-4 col-sm-6 <?php echo $cv_gallery_class_array; ?>" data-src="<?php echo $image_link['0']; ?>">
  41.                 <a href="javascript:">
  42.                     <figure>
  43.                         <?php the_post_thumbnail(); ?>
  44.                         <figcaption>
  45.                             <h4><?php the_title(); ?></h4>
  46.                             <p><?php echo $cv_gallery_cat_array; ?></p>
  47.                         </figcaption>
  48.                     </figure>
  49.                 </a>
  50.             </div>
  51.             <?php endwhile; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement