Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Portfolio
- */
- global $k_option, $more;
- get_header();
- $more = 0;
- $overview_post_id = $post->ID;
- $posts_per_page = 9999;
- $query_string = "posts_per_page=".$posts_per_page;
- $query_string .= "&post_type=portfolio";
- //$query_string .= "&portfolio_entries=".$k_option['portfolio']['matrix_slider_port_final'][$post->ID]; //doesnt work in wp3.0
- // the query string now looks like this:
- // "cat=3,10,12&posts_per_page=9&paged=$paged";
- // you can add additional query options if you want, all of them are described here:
- // http://codex.wordpress.org/Template_Tags/query_posts#Examples
- // append this parameters with the "&" sign
- // example: $query_string = $query_string."&orderby=author&order=ASC";
- $additional_loop = new WP_Query($query_string);
- $categories = get_categories('title_li=&orderby=name&hide_empty=0&taxonomy=portfolio_entries&include='.$k_option['portfolio']['matrix_slider_port_final'][$post->ID]);
- echo '<div class="wrapper" id="wrapper_heading">';
- echo '<div class="center">';
- ?>
- <div id='js_sort_items'>
- <?php
- //check if we got more than one category
- $hide = "hidden";
- if (isset($categories[1])){ $hide = ""; } ?>
- <div class='sort_by_cat <?php echo $hide; ?>'>
- <span><?php _e('Show:','cleancut')?></span>
- <a href="#" id='all_sort' class='active_sort'><?php _e('All','cleancut')?></a>
- <?php
- foreach($categories as $category)
- {
- echo '<a href="#" id="'.$category->category_nicename.'_sort">'.$category->cat_name.'</a>';
- }
- ?>
- </div>
- <div class='sort_by_val'>
- <span><?php _e('Sort by:','cleancut')?></span>
- <a href="#" id='date_sort' class='active_sort reversed'><?php _e('Date','cleancut')?></a>
- <a href="#" id='name_sort'><?php _e('Name','cleancut')?></a>
- </div>
- <!--end sort_items-->
- </div>
- <?php
- echo '</div></div>';
- ?>
- <div class="wrapper fullwidth" id='wrapper_main'>
- <div class="center">
- <div id="main" class='portfolio'>
- <?php
- $catarray = explode(',',$k_option['portfolio']['matrix_slider_port_final'][$overview_post_id]);
- if($additional_loop->have_posts()) :
- $the_link = get_post_meta($post->ID, "link", true);
- $columns = 4; // how many items beside each other?
- $count = 1;
- $last = '';
- $openImage = 'lightbox';
- if($k_option['portfolio']['portfolio_click'] == 2) $openImage = 'permalink';
- while ($additional_loop->have_posts()) : $additional_loop->the_post();
- $item_categories = get_the_terms( $id, 'portfolio_entries' );
- $class_add = "";
- $displayPost = false;
- if(is_object($item_categories) || is_array($item_categories))
- {
- foreach ($item_categories as $cat)
- {
- $class_add .= $cat->slug.'_sort ';
- if(in_array($cat->term_id, $catarray))
- {
- $displayPost = true;
- }
- }
- }
- if($displayPost)
- {
- if($count == 1) echo '<div class="entry portfolio_entry">';
- if($count == $columns) $last = 'last';
- $prev_image = kriesi_post_thumb($post->ID, array('size'=> array('M','_preview_medium'),
- 'wh' => $k_option['custom']['imgSize']['M'],
- 'display_link' => array($openImage),
- 'linkurl' => array ('XL','_preview_big')
- ));
- echo "<div class='one_fourth all_sort $class_add $last'>";
- echo $prev_image;
- echo "<h3 class='name_sort'>".get_the_title()."</h3>";
- echo "<span class='date_sort hidden'>";
- the_time('Y m d H i s');
- echo "</span>";
- the_excerpt();
- echo "<a href='".$the_link."' class='more-link'>".__('Read more','cleancut')."</a>";
- echo "</div>";
- if($count == $columns)
- {
- $last = '';
- $count = 0;
- echo "</div>";
- }
- $count ++;
- }
- endwhile;
- if($count != 1) echo "</div>";
- endif;
- ?>
- <!--end main-->
- </div>
- <div id="footer_inside">
- <!--end footer_inside-->
- </div>
- <!-- end center-->
- </div>
- <!--end wrapper-->
- </div>
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement