Created
January 3, 2013 11:30
-
-
Save syamilmj/4442840 to your computer and use it in GitHub Desktop.
template-portfolio.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Template Name: Portfolio | |
*/ | |
$column = strtolower($data['aq_portfolio_layout']); //Get number of columns | |
get_header(); ?> | |
<div id="content-full-width" class="cf"> | |
<div id="portfolio-header"> | |
<div class="the-top"> | |
<div class="the-title"><h1><?php the_title(); ?></h1></div> | |
</div> | |
<div id="category-select" class="dropdown radius3"> | |
<div class="selected radius3"> | |
<a href="#"><?php _e('Kategorien','framework'); ?></a> | |
</div> | |
<?php | |
$taxonomy = 'portfolio_categories'; | |
$show_option_all = ''; | |
$orderby = 'name'; | |
$order = 'ASC'; | |
$show_count = 1; // 1 for yes, 0 for no | |
$pad_counts = 1; // 1 for yes, 0 for no | |
$hierarchical = 1; // 1 for yes, 0 for no | |
$title = ''; | |
$walker = new Portfolio_Walker(); | |
$args = array( | |
'taxonomy' => $taxonomy, | |
'show_option_all' => $show_option_all, | |
'orderby' => $orderby, | |
'order' => $order, | |
'show_count' => $show_count, | |
'show_option_none' => false, | |
'pad_counts' => $pad_counts, | |
'hierarchical' => $hierarchical, | |
'title_li' => $title, | |
'walker' => $walker | |
); | |
?> | |
<div class="options"> | |
<ul id="sort" class="btmradius5"> | |
<li><a href="#" class="all"><span>Alle</span></a></li> | |
<?php wp_list_categories( $args ); ?> | |
</ul> | |
</div> | |
</div> | |
</div> | |
<ul class="items <?php echo $column; ?>"> | |
<?php | |
$count = 1; | |
$type = 'portfolio'; | |
$args=array( | |
'post_type' => $type, | |
'orderby' => $orderby, | |
'order' => $order, | |
'posts_per_page' => -1 | |
); | |
query_posts($args); | |
$size = aq_get_items_column_size($column); //get columns size | |
$title_limit = 40; //portfolio title characters limit | |
if(!empty($data['portfolio_title_limit'])) { | |
$title_limit = (int) $data['portfolio_title_limit']; | |
} | |
$excerpt_limit = 10; //portfolio excerpt words limit | |
if(!empty($data['portfolio_excerpt_limit'])) { | |
$excerpt_limit = (int) $data['portfolio_excerpt_limit']; | |
} | |
if (have_posts()) : while (have_posts()) : the_post(); | |
$terms = ''; $video_thumb_src = ''; $custom_thumbnail =''; //initialize variables | |
$video_url = get_post_meta(get_the_ID(), 'aq_video_url', TRUE); | |
$video_thumb_src = get_post_meta(get_the_ID(), 'aq_video_thumbnail', TRUE); | |
$custom_thumbnail = get_post_meta(get_the_ID(), 'aq_custom_thumbnail', TRUE); | |
if (!empty($video_thumb_src) && !empty($video_url)) { | |
$image = vt_resize( $video_thumb_src, $size['img_width'], $size['img_height'], true ); | |
$image_url = get_bloginfo('template_url').'/includes/portfolio-video.php?ID='.get_the_ID(); | |
} elseif(!empty($custom_thumbnail)) { | |
$thumb = get_attachment_id_from_src($custom_thumbnail); | |
if(empty($thumb)) {$thumb = '';} | |
$image = vt_resize( $thumb, '', $size['img_width'], $size['img_height'], true ); | |
$image_src = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); | |
$image_url = aq_resize($custom_thumbnail, $size['img_width'], $size['img_height'], true); | |
} elseif (has_post_thumbnail()) { | |
$thumb = get_post_thumbnail_id(); | |
$img_url = wp_get_attachment_url($thumb); | |
$image = aq_resize( $img_url, $size['img_width'], $size['img_height'], true ); | |
$image_url = $image; | |
} | |
$terms = get_the_terms( get_the_ID(), 'portfolio_categories' ); | |
?> | |
<li class="item" data-type="<?php foreach ($terms as $term) { echo strtolower(preg_replace('/\s+/', '-', $term->name)).' '; } ?>" data-id="<?php echo $count; ?>"> | |
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<?php if (has_post_thumbnail() || !empty($video_thumb_src)) { ?> | |
<div class="post-thumb-wrap image-wrap-out radius3"> | |
<div class="post-thumb image-wrap-in radius3 nothook"> | |
<a class="lightbox" href="<?php echo $image_url; ?>"> | |
<span class="overlay"></span> | |
<img src="<?php echo $image['url']; ?>" alt="" width="<?php echo $size['img_width'];?>" height="<?php echo $size['img_height'];?>"/> | |
</a> | |
</div> | |
</div> | |
<?php } ?> | |
<div class="the-title"> | |
<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php echo shortentext(get_the_title(), $title_limit); ?></a></h2> | |
</div> | |
<div class="the-excerpt"> | |
<p><?php aq_excerpt($excerpt_limit); ?></p> | |
</div> | |
</div> | |
</li><!--END .item --> | |
<?php $count++; endwhile; endif; wp_reset_query(); ?> | |
</ul><!--/.portfolio-items--> | |
</div><!--/#content-full-width--> | |
</div><!--/#main-container--> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment