Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Portfolio with Filter
- */
- global $data;
- ?>
- <?php get_header(); ?>
- <section class="page-title">
- <div class="double-separator"></div>
- <div class="breadcrumbs">
- <div class="one-fourth align-left">
- <?php if (function_exists('dt_breadcrumbs')) dt_breadcrumbs(); ?>
- </div>
- <div class="three-fourth column-last align-right">
- <ul id="filters">
- <li><?php _e('Sort By: ', 'haze'); ?></li>
- <li class="selected active"><a data-value="all" href="#"><?php _e('All', 'haze') ?></a></li>
- <?php
- $terms = get_terms('portfolio_cats');
- $count = count($terms);
- $i=0;
- $term_list = '';
- if ($count > 0) {
- foreach ($terms as $term) {
- $i++;
- $term_list .= '<li class=""><a href="#" data-value="'. $term->slug .'" class="'. $term->slug .'">' . $term->name . '</a></li>';
- if ($count != $i)
- {
- $term_list .= '';
- }
- else
- {
- $term_list .= '';
- }
- }
- echo $term_list;
- }
- ?>
- </ul>
- </div>
- </div><!--end breadcrumbs-->
- <div class="double-separator"></div>
- </section>
- </div><!--end top-->
- <div class="centered-wrapper">
- <section id="portfolio-wrapper">
- <?php if ( post_password_required() ) echo get_the_password_form(); else { ?>
- <ul class="portfolio <?php if($data['portfolio_cols']) echo strtolower($data['portfolio_cols']); ?>-columns">
- <?php
- //get post type - portfolio
- query_posts(array(
- 'post_type'=>'portfolio',
- 'posts_per_page' => -1,
- 'paged'=>$paged
- ));
- // Begin The Loop
- if (have_posts()) : while (have_posts()) : the_post();
- // Get The Taxonomy 'Filter' Categories
- $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
- //Apply a data-id for unique indentity,
- //and loop through the taxonomy and assign the terms to the portfolio item
- // which will be referenced to Quicksand
- ?>
- <li data-id="id-<?php echo $count; ?>" class="<?php if($terms) { foreach ($terms as $term) { echo $term->slug .' '; } } else { echo 'none'; } ?>">
- <?php
- // Check if wordpress supports featured images, and if so output the thumbnail
- if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
- // Output the featured image ?>
- <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a>
- <?php endif; ?>
- <?php // Output the title of each portfolio item ?>
- <h4><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h4>
- <?php the_excerpt(); ?>
- <div class="count hidden"></div>
- </li>
- <?php $count++; // Increase the count by 1 ?>
- <?php endwhile; endif; // END the Wordpress Loop ?>
- <?php wp_reset_query(); // Reset the Query Loop ?>
- </ul>
- <?php } ?>
- </section>
- </div><!--end centered-wrapper-->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement