Advertisement
Guest User

Portfolio Template (Kriesi)

a guest
Jul 25th, 2010
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.26 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Portfolio
  4. */
  5. global $k_option, $more;
  6.  
  7. get_header();
  8.  
  9.  
  10. $more = 0;
  11. $overview_post_id = $post->ID;
  12. $posts_per_page = 9999;
  13. $query_string = "posts_per_page=".$posts_per_page;
  14. $query_string .= "&post_type=portfolio";
  15. //$query_string .= "&portfolio_entries=".$k_option['portfolio']['matrix_slider_port_final'][$post->ID]; //doesnt work in wp3.0
  16.  
  17.  
  18. // the query string now looks like this:
  19. // "cat=3,10,12&posts_per_page=9&paged=$paged";
  20. // you can add additional query options if you want, all of them are described here:
  21. // http://codex.wordpress.org/Template_Tags/query_posts#Examples
  22. // append this parameters with the "&" sign
  23.  
  24. // example: $query_string = $query_string."&orderby=author&order=ASC";
  25.  
  26. $additional_loop = new WP_Query($query_string);
  27. $categories = get_categories('title_li=&orderby=name&hide_empty=0&taxonomy=portfolio_entries&include='.$k_option['portfolio']['matrix_slider_port_final'][$post->ID]);
  28.  
  29.  
  30. echo '<div class="wrapper" id="wrapper_heading">';
  31. echo '<div class="center">';
  32. ?>
  33. <div id='js_sort_items'>
  34.  
  35. <?php
  36. //check if we got more than one category
  37. $hide = "hidden";
  38. if (isset($categories[1])){ $hide = ""; } ?>
  39.  
  40. <div class='sort_by_cat <?php echo $hide; ?>'>
  41. <span><?php _e('Show:','cleancut')?></span>
  42. <a href="#" id='all_sort' class='active_sort'><?php _e('All','cleancut')?></a>
  43. <?php
  44. foreach($categories as $category)
  45. {
  46. echo '<a href="#" id="'.$category->category_nicename.'_sort">'.$category->cat_name.'</a>';
  47. }
  48. ?>
  49. </div>
  50.  
  51.  
  52. <div class='sort_by_val'>
  53. <span><?php _e('Sort by:','cleancut')?></span>
  54. <a href="#" id='date_sort' class='active_sort reversed'><?php _e('Date','cleancut')?></a>
  55. <a href="#" id='name_sort'><?php _e('Name','cleancut')?></a>
  56. </div>
  57.  
  58. <!--end sort_items-->
  59. </div>
  60. <?php
  61. echo '</div></div>';
  62. ?>
  63.  
  64. <div class="wrapper fullwidth" id='wrapper_main'>
  65.  
  66. <div class="center">
  67.  
  68. <div id="main" class='portfolio'>
  69.  
  70. <?php
  71. $catarray = explode(',',$k_option['portfolio']['matrix_slider_port_final'][$overview_post_id]);
  72. if($additional_loop->have_posts()) :
  73. $the_link = get_post_meta($post->ID, "link", true);
  74. $columns = 4; // how many items beside each other?
  75.  
  76. $count = 1;
  77. $last = '';
  78.  
  79. $openImage = 'lightbox';
  80. if($k_option['portfolio']['portfolio_click'] == 2) $openImage = 'permalink';
  81.  
  82. while ($additional_loop->have_posts()) : $additional_loop->the_post();
  83. $item_categories = get_the_terms( $id, 'portfolio_entries' );
  84. $class_add = "";
  85. $displayPost = false;
  86.  
  87. if(is_object($item_categories) || is_array($item_categories))
  88. {
  89. foreach ($item_categories as $cat)
  90. {
  91. $class_add .= $cat->slug.'_sort ';
  92. if(in_array($cat->term_id, $catarray))
  93. {
  94. $displayPost = true;
  95. }
  96. }
  97. }
  98.  
  99. if($displayPost)
  100. {
  101.  
  102. if($count == 1) echo '<div class="entry portfolio_entry">';
  103. if($count == $columns) $last = 'last';
  104.  
  105.  
  106.  
  107. $prev_image = kriesi_post_thumb($post->ID, array('size'=> array('M','_preview_medium'),
  108. 'wh' => $k_option['custom']['imgSize']['M'],
  109. 'display_link' => array($openImage),
  110. 'linkurl' => array ('XL','_preview_big')
  111. ));
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119. echo "<div class='one_fourth all_sort $class_add $last'>";
  120.  
  121. echo $prev_image;
  122. echo "<h3 class='name_sort'>".get_the_title()."</h3>";
  123. echo "<span class='date_sort hidden'>";
  124. the_time('Y m d H i s');
  125.  
  126. echo "</span>";
  127.  
  128. the_excerpt();
  129.  
  130. echo "<a href='".$the_link."' class='more-link'>".__('Read more','cleancut')."</a>";
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. echo "</div>";
  139.  
  140.  
  141.  
  142.  
  143. if($count == $columns)
  144. {
  145. $last = '';
  146. $count = 0;
  147. echo "</div>";
  148. }
  149. $count ++;
  150. }
  151. endwhile;
  152.  
  153. if($count != 1) echo "</div>";
  154.  
  155. endif;
  156. ?>
  157.  
  158. <!--end main-->
  159. </div>
  160.  
  161.  
  162. <div id="footer_inside">
  163.  
  164. <!--end footer_inside-->
  165. </div>
  166.  
  167. <!-- end center-->
  168. </div>
  169. <!--end wrapper-->
  170. </div>
  171.  
  172. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement