';
$approvedcat = array();
$sideoutput = "";
if( count($categories)!=0 ){
foreach ($categories as $key) {
$catname = get_term_by("slug",$key,"category");
$approvedcat[] = $key;
}
}
$approvedcatID = array();
$filteroutput = $filterlioutput = '';
$approvedcatslug = '';
$isotopeclass = "";
if( count($categories)>1 ){
$filteroutput .= '
';
$isotopeclass = "portfoliolist";
$showposts = -1;
}elseif( count($categories)==1 ){
foreach ($categories as $key) {
$catname = get_term_by("slug",$key,"category");
$approvedcatID[] = $key;
}
}
echo $filteroutput;
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$args = array(
'post_type' => 'post',
'showposts' => $showposts,
'orderby' => 'date'
);
if( count($approvedcatID) ){
$args['tax_query'] = array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $approvedcat
)
);
}
$wp_query->query($args);
global $post;
$tpl = '
';
$tpl = apply_filters( 'klasik_pfilter_item_template', $tpl );
if ($wp_query->have_posts()) :
$x = 0;
$output = "";
$output .= '
';
while ($wp_query->have_posts()) : $wp_query->the_post();
$template = $tpl;
$custom = get_post_custom($post->ID);
$cf_customdesc = get_the_title() ;
$x++;
if($cols==1){
$colclass = "twelve columns";
}elseif($cols==2){
$colclass = "one_half columns";
}elseif($cols==3){
$colclass = "one_third columns";
}elseif($cols==4){
$colclass = "one_fourth columns";
}elseif($cols==5){
$colclass = "one_fifth columns";
}elseif($cols==6){
$colclass = "one_sixth columns";
}
if($x%$cols==0){
$omega = "omega";
}elseif($x%$cols==1){
$omega = "alpha";
}else{
$omega = "";
}
$itemclass = $colclass .' '. $omega;
//get post-thumbnail attachment
$attachments = get_children( array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'orderby' => 'menu_order',
'post_mime_type' => 'image')
);
$fullimageurl = '';
$cf_thumb2 = '';
foreach ( $attachments as $att_id => $attachment ) {
$getimage = wp_get_attachment_image_src($att_id, 'widget-portfolio', true);
$fullimage = wp_get_attachment_image_src($att_id, 'full', true);
$portfolioimage = $getimage[0];
$cf_thumb2 ='
';
$thethumblb = $portfolioimage;
$fullimageurl = $fullimage[0];
}
//thumb image
if(has_post_thumbnail($post->ID)){
$cf_thumb = get_the_post_thumbnail($post->ID, 'widget-portfolio');
$thumb_id = get_post_thumbnail_id($post->ID);
$args = array(
'post_type' => 'attachment',
'post_status' => null,
'include' => $thumb_id
);
$fullimage = wp_get_attachment_image_src($thumb_id, 'full', true);
$fullimageurl = $fullimage[0];
$thumbnail_image = get_posts($args);
if ($thumbnail_image && isset($thumbnail_image[0])) {
$cf_customdesc = $thumbnail_image[0]->post_content;
}
}else{
$cf_thumb = $cf_thumb2;
}
$ids = get_the_ID();
$addclass="";
$catinfos = get_the_terms($post->ID,'category');
$key = "";
if($catinfos){
foreach($catinfos as $catinfo){
$key .= " ".$catinfo->slug;
}
$key = trim($key);
}
//PORTFOLIOID
$template = str_replace( '%%ID%%', $post->ID, $template );
//PORTFOLIOKEY
$pfkey = $key;
$template = str_replace( '%%KEY%%', $pfkey, $template );
//PORTFOLIOCLASS
$pfclass = 'item ';
$pfclass .= $itemclass.' ';
$pfclass .= $key;
$template = str_replace( '%%CLASS%%', $pfclass, $template );
//PORTFOLIOFULLIMAGE
$pffullimg = $fullimageurl;
$template = str_replace( '%%FULLIMG%%', $pffullimg, $template );
//PORTFOLIOIMGTITLE
$pffullimgtitle = $cf_customdesc;
$template = str_replace( '%%FULLIMGTITLE%%', $pffullimgtitle, $template );
//PORTFOLIOLINK
$pflink = get_permalink();
$template = str_replace( '%%LINK%%', $pflink, $template );
//PORTFOLIOIMAGE
$pfthumb = '';
$pfthumb .= $cf_thumb;
$template = str_replace( '%%THUMB%%', $pfthumb, $template );
//PORTFOLIOTITLE
$pftitle = '';
$pftitle .= get_the_title();
$template = str_replace( '%%TITLE%%', $pftitle, $template );
//PORTFOLIOTEXT
$pftext = '';
if($longdesc>0){
$excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc);
}else{
$excerpt = get_the_excerpt();
}
$pftext .= $excerpt;
$template = str_replace( '%%TEXT%%', $pftext, $template );
//PORTFOLIOCATEGORY
$pfcat = '';
$categories = get_the_category();
$separator = ', ';
if($categories){
foreach($categories as $category) {
$pfcat .= '
name ) ) . '">'.$category->cat_name.''.$separator;
}
}
$template = str_replace( '%%CATEGORY%%', trim($pfcat, $separator), $template );
$output .= $template;
endwhile;
$output .= '
';
$wp_query = null; $wp_query = $temp; wp_reset_query();
echo $output;
endif;
$wp_query = null; $wp_query = $temp; wp_reset_query();
echo '