Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Query for all the portfolio posts
- $args = array(
- 'post_type' => 'portfolio',
- 'posts_per_page' => $limit,
- );
- $posts = new WP_Query( $args );
- if( $posts->have_posts() ) :
- ?>
- <div class="portfolio-containered">
- <div class="portfolio-wrapper">
- <?php if( $pf_switch == 'yes' ) : ?>
- <div class=" <?php echo implode(' ', $portfolio_filter_class); ?>">
- <button class="active button-flt" data-filter="*">all work</button>
- <?php
- $terms = get_terms( 'portfolio-type' );
- $count = count( $terms );
- if ( $count > 0 ) {
- foreach ( $terms as $term ) {
- echo '<button class="button-flt" data-filter=".'. esc_attr( strtolower( $term->name ) ) .'">'. esc_attr( strtolower( $term->name ) ) .'</button>';
- }
- }
- ?>
- </div>
- <?php endif; ?>
- <div class="portfolio portfolio-gutter portfolio-masonry portfolio-3-column hover-with-border portfolio-ajax">
- <?php
- while( $posts->have_posts() ) :
- $posts->the_post();
- // Get taxonomies for single portfolio posts
- $types = get_the_terms( $posts->ID, 'portfolio-type' );
- $typesCount = count( $types );
- $count = 0;
- $termArr = array();
- // Loop over throuth each the terms
- if( $types ) {
- foreach($types as $type) {
- $termArr[] = strtolower( $type->name ) ;
- }
- }
- ?>
- <div class="portfolio-item <?php echo implode(' ', $termArr); ?> ">
- <div class="portfolio-item-content">
- <?php if ( has_post_thumbnail() ) : ?>
- <div class="item-thumbnail">
- <?php the_post_thumbnail( $posts->ID , 'maxive-portfolio-img-large'); ?>
- </div>
- <?php else: ?>
- <div class="item-thumbnail">
- <img src="<?php echo get_template_directory_uri(); ?>/assets/img/placeholder-image.jpg" alt="">
- </div>
- <?php endif; ?>
- <div class="portfolio-description">
- <h4><a href="#" ><?php the_title(); ?></a></h4>
- <span class="portfolio-category">
- <?php
- // Increment the counter
- $count++;
- echo implode(', ', $termArr);
- ?>
- </span>
- </div>
- </div>
- </div>
- <?php
- endwhile;
- wp_reset_postdata();
- ?>
- </div>
- <div class="col-md-12 text-center pt-20 pf-load-more-wrapper">
- <a href="#" class="maxive-pf-load-more" data-pf-object='<?php echo $maxive_pf_ajax_options; ?>'>LOAD MORE +</a>
- </div>
- </div>
- </div>
- <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment