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.  
  53. <!--<div class='sort_by_val'>
  54. <span><?php _e('Sort by:','cleancut')?></span>
  55. <a href="#" id='date_sort' class='active_sort reversed'><?php _e('Date','cleancut')?></a>
  56. <a href="#" id='name_sort'><?php _e('Name','cleancut')?></a>
  57. </div>
  58.  
  59. <!--end sort_items-->
  60. </div> <div id="portfoliotext">Longtime champion Arabian breeders Arabians Ltd. offers some of its finest Egyptian Arabian horses for sale. Our experts can guide you through the whole process of selecting the perfect Arabian horse for your needs and goals!</div>
  61. <?php
  62. echo '</div></div>';
  63. ?>
  64.  
  65. <div class="wrapper fullwidth" id='wrapper_main'>
  66.  
  67. <div class="center">
  68.  
  69. <div id="main" class='portfolio'>
  70.  
  71.  
  72. <?php
  73. $catarray = explode(',',$k_option['portfolio']['matrix_slider_port_final'][$overview_post_id]);
  74. if($additional_loop->have_posts()) : $the_link= get_post_meta($post->ID, "link", true);
  75.  
  76. $columns = 3; // how many items beside each other?
  77.  
  78. $count = 1;
  79. $last = '';
  80.  
  81. $openImage = 'lightbox';
  82. if($k_option['portfolio']['portfolio_click'] == 2) $openImage = 'permalink';
  83.  
  84. while ($additional_loop->have_posts()) : $additional_loop->the_post();
  85. $item_categories = get_the_terms( $id, 'portfolio_entries' );
  86. $class_add = "";
  87. $displayPost = false;
  88.  
  89. if(is_object($item_categories) || is_array($item_categories))
  90. {
  91. foreach ($item_categories as $cat)
  92. {
  93. $class_add .= $cat->slug.'_sort ';
  94. if(in_array($cat->term_id, $catarray))
  95. {
  96. $displayPost = true;
  97. }
  98. }
  99. }
  100.  
  101. if($displayPost)
  102. {
  103.  
  104. if($count == 1) echo '<div class="entry portfolio_entry">';
  105. if($count == $columns) $last = 'last';
  106.  
  107.  
  108.  
  109. $prev_image = kriesi_post_thumb($post->ID, array('size'=> array('M','_preview_medium'),
  110. 'wh' => $k_option['custom']['imgSize']['M'],
  111. 'display_link' => array($openImage),
  112. 'linkurl' => array ('XL','_preview_big')
  113. ));
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121. echo "<div class='one_fourth all_sort $class_add $last'>";
  122.  
  123. echo $prev_image;
  124. echo "<h3 class='name_sort'>".get_the_title()."</h3>";
  125. echo "<span class='date_sort hidden'>";
  126. the_time('Y m d H i s');
  127.  
  128. echo "</span>";
  129.  
  130. the_excerpt();
  131.  
  132. if (get_post_meta($post->ID, 'website', true) != ''){
  133. echo "<a href='".get_post_meta($post->ID, 'website', true)."' class='more-link'>".__('Go to Portfolio','cleancut')."</a>";
  134. }else{
  135. $the_link = get_post_meta($post->ID, 'link', true);
  136. echo "<a href='".$the_link."' class='more-link'>".__('See More','cleancut')."</a>";
  137.  
  138. }
  139.  
  140.  
  141. echo "</div>";
  142.  
  143.  
  144.  
  145.  
  146. if($count == $columns)
  147. {
  148. $last = '';
  149. $count = 0;
  150. echo "</div>";
  151. }
  152. $count ++;
  153. }
  154. endwhile;
  155.  
  156. if($count != 1) echo "</div>";
  157.  
  158. endif;
  159. ?>
  160.  
  161. <!--end main-->
  162. </div>
  163.  
  164.  
  165.  
  166. <?php get_footer(); ?>