deliciousthemes

Haze - Portfolio Page v1.3

Feb 10th, 2013
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.11 KB | None | 0 0
  1. <?php
  2. /*
  3.  
  4. Template Name: Portfolio
  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-third align-left">
  15.                     <?php if (function_exists('dt_breadcrumbs')) dt_breadcrumbs(); ?>
  16.                 </div>
  17.                
  18.                 <div class="two-third column-last align-right">        
  19.                     <?php
  20.                         $categs = get_post_meta($post->ID,'haze_cats_field');
  21.                         $layout = get_post_meta($post->ID,'haze_portfolio_columns',true);
  22.                         $navig = get_post_meta($post->ID,'haze_portfolio_navigation',true);
  23.                         $nav_number = get_post_meta($post->ID,'haze_nav_number',true);             
  24.                        
  25.                             $i=0;
  26.                             $count =0;
  27.                             $term_list ='';    
  28.                             $list = '';
  29.                             foreach ($categs as $categ) {
  30.                                 $i++;
  31.                                
  32.                                 $to_replace = array(' ', '/', '&');
  33.                                 $intermediate_replace = strtolower(str_replace($to_replace, '-', $categ));
  34.                                 $str = preg_replace('/--+/', '-', $intermediate_replace);
  35.                                
  36.                                 $term_list .= '<li class=""><a href="#" data-value="'. $str .'" class="dt-'. $str .'">' . $categ . '</a></li>';
  37.                                 $list .= $categ . ', ';
  38.                                 if ($count != $i)
  39.                                 {
  40.                                     $term_list .= '';
  41.                                 }
  42.                                 else
  43.                                 {
  44.                                     $term_list .= '';
  45.                                 }
  46.                             }
  47.                                 if (($i > 1) && ($navig == 'filter')) { ?>
  48.                                     <ul id="filters">
  49.                                         <li><?php _e('Sort By: ', 'haze'); ?></li> 
  50.                                         <li class="selected active"><a data-value="all" href="#">All</a></li>
  51.                                    
  52.                                     <?php  
  53.                                     echo $term_list; ?>
  54.                                     </ul>
  55.                                     <?php
  56.                                 }      
  57.                                 else if (($i = 1) && ($navig == 'filter')) { ?>
  58.                                     <ul id="filters">
  59.                                     <?php  
  60.                                     echo $categ; ?>
  61.                                     </ul>
  62.                                     <?php
  63.                                 }                              
  64.                                
  65.                                
  66.                        
  67.                     ?>
  68.                 </div>
  69.             </div><!--end breadcrumbs-->
  70.             <div class="double-separator"></div>
  71.         </section>
  72.     </div><!--end top-->
  73.  
  74.     <div class="centered-wrapper">
  75.  
  76.         <section id="portfolio-wrapper">
  77.             <ul class="portfolio <?php echo $layout; ?>">
  78.            
  79.                 <?php
  80.                     $show_number = '-1';
  81.                 if ($navig == 'no-filter') {
  82.                     if (!empty($nav_number)) {
  83.                         $show_number = $nav_number;
  84.                     }
  85.                     else $show_number = 8;
  86.                 }
  87.                
  88.                 //get post type - portfolio
  89.                 query_posts(array(
  90.                     'post_type'=>'portfolio',
  91.                     'posts_per_page' => $show_number,
  92.                     'term' => 'portfolio_cats',
  93.                     'portfolio_cats' => $list,
  94.                     'paged'=>$paged
  95.                 ));
  96.  
  97.                 // Begin The Loop
  98.                 if (have_posts()) : while (have_posts()) : the_post();         
  99.  
  100.                 // Get The Taxonomy 'Filter' Categories
  101.                 $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
  102.  
  103.                 //Apply a data-id for unique indentity,
  104.                 //and loop through the taxonomy and assign the terms to the portfolio item
  105.                 // which will be referenced to Quicksand
  106.  
  107.                 ?>
  108.                 <li data-id="id-<?php echo $count; ?>" class="<?php if($terms) { foreach ($terms as $term) {
  109.  
  110.                
  111.                     $new_to_replace = array(' ', '/', '&');
  112.                     $new_intermediate_replace = strtolower(str_replace($new_to_replace, '-', $term->name));
  113.                     $new_str = preg_replace('/--+/', '-', $new_intermediate_replace);              
  114.                    
  115.                     echo $new_str .' ';
  116.                
  117.                 } } else { echo 'none'; } ?>">
  118.                          
  119.                     <?php  
  120.                         // Check if wordpress supports featured images, and if so output the thumbnail
  121.                     if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
  122.                        
  123.                         // Output the featured image ?>
  124.                         <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a>
  125.                        
  126.                     <?php endif; ?>
  127.                        
  128.                     <?php // Output the title of each portfolio item ?>
  129.                     <h4><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h4>
  130.                     <?php the_excerpt(); ?>
  131.                     <div class="count hidden"></div>
  132.                 </li>
  133.  
  134.                 <?php $count++; // Increase the count by 1 ?>      
  135.                 <?php endwhile; endif; // END the Wordpress Loop ?>    
  136.             </ul>      
  137.             <?php dt_navigation(); ?>
  138.             <?php wp_reset_query(); // Reset the Query Loop ?>                 
  139.         </section>
  140.  
  141.     </div><!--end centered-wrapper-->
  142.  
  143. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment