Advertisement
deliciousthemes

Portfolio Thumbnails modified to open an image

Sep 24th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.18 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4. Template Name: Portfolio with Filter
  5.  
  6.  */
  7. global $data;
  8. ?>
  9. <?php get_header(); ?>
  10.  
  11.         <section class="page-title">
  12.             <div class="double-separator"></div>
  13.             <div class="breadcrumbs">
  14.                 <div class="one-fourth align-left">
  15.                     <?php if (function_exists('dt_breadcrumbs')) dt_breadcrumbs(); ?>
  16.                 </div>
  17.                
  18.                 <div class="three-fourth column-last align-right">
  19.                     <ul id="filters">
  20.                         <li><?php _e('Sort By: ', 'haze'); ?></li>
  21.                         <li class="selected active"><a data-value="all" href="#"><?php _e('All', 'haze') ?></a></li>
  22.                         <?php
  23.                             $terms = get_terms('portfolio_cats');
  24.                             $count = count($terms);
  25.                             $i=0;
  26.                             $term_list = '';
  27.                             if ($count > 0) {
  28.                                 foreach ($terms as $term) {
  29.                                     $i++;
  30.                                     $term_list .= '<li class=""><a href="#" data-value="'. $term->slug .'" class="'. $term->slug .'">' . $term->name . '</a></li>';
  31.                                     if ($count != $i)
  32.                                     {
  33.                                         $term_list .= '';
  34.                                     }
  35.                                     else
  36.                                     {
  37.                                         $term_list .= '';
  38.                                     }
  39.                                 }
  40.                                 echo $term_list;
  41.                             }
  42.                         ?>
  43.                     </ul>                  
  44.                 </div>
  45.             </div><!--end breadcrumbs-->
  46.             <div class="double-separator"></div>
  47.         </section>
  48.     </div><!--end top-->
  49.  
  50.     <div class="centered-wrapper">
  51.  
  52.         <section id="portfolio-wrapper">
  53.        
  54.         <?php if ( post_password_required() ) echo get_the_password_form(); else { ?>
  55.        
  56.             <ul class="portfolio <?php if($data['portfolio_cols']) echo strtolower($data['portfolio_cols']); ?>-columns">
  57.            
  58.                 <?php
  59.                 //get post type - portfolio
  60.                 query_posts(array(
  61.                     'post_type'=>'portfolio',
  62.                     'posts_per_page' => -1,
  63.                     'paged'=>$paged
  64.                 ));
  65.  
  66.                 // Begin The Loop
  67.                 if (have_posts()) : while (have_posts()) : the_post();
  68.                
  69.                 // Get The Taxonomy 'Filter' Categories
  70.                 $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
  71.  
  72.                 //Apply a data-id for unique indentity,
  73.                 //and loop through the taxonomy and assign the terms to the portfolio item
  74.                 // which will be referenced to Quicksand
  75.                 ?>
  76.                 <li data-id="id-<?php echo $count; ?>" class="<?php if($terms) { foreach ($terms as $term) { echo $term->slug .' '; } } else { echo 'none'; } ?>">
  77.                          
  78.                     <?php  
  79.                         // Check if wordpress supports featured images, and if so output the thumbnail
  80.                     if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
  81.                    
  82.                         $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'portfolio-single' );
  83.                        
  84.                         // Output the featured image ?>
  85.                         <a rel="prettyPhoto[pp_gal]" href="<?php echo $image[0]; ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a>
  86.                        
  87.                     <?php endif; ?>
  88.                        
  89.                     <?php // Output the title of each portfolio item ?>
  90.                     <h4><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h4>
  91.                     <?php the_excerpt(); ?>
  92.                     <div class="count hidden"></div>
  93.                 </li>
  94.  
  95.                 <?php $count++; // Increase the count by 1 ?>      
  96.                 <?php endwhile; endif; // END the Wordpress Loop ?>
  97.                 <?php wp_reset_query(); // Reset the Query Loop ?>         
  98.             </ul>  
  99.             <?php } ?>
  100.         </section>
  101.  
  102.     </div><!--end centered-wrapper-->
  103.  
  104. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement