'widget_klasik_pfilter', 'description' => __('KlasikThemes Portfolio Filter','klasik') ); $this->WP_Widget('klasik-theme-pfilter-widget', __('KlasikThemes Portfolio Filter','klasik'), $widget_ops); } /** @see WP_Widget::widget */ function widget($args, $instance) { extract( $args ); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']); $subtitle = apply_filters('widget_subtitle', empty($instance['subtitle']) ? '' : $instance['subtitle']); $cats = apply_filters('widget_category', empty($instance['category']) ? array() : $instance['category']); $display = apply_filters('widget_display', empty($instance['display']) ? '' : $instance['display']); $cols = apply_filters('widget_cols', empty($instance['cols']) ? '' : $instance['cols']); $showposts = apply_filters('widget_showpost', empty($instance['showpost']) ? '' : $instance['showpost']); $longdesc = apply_filters('widget_longdesc', empty($instance['longdesc']) ? '' : $instance['longdesc']); $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']); $enablepagenum = isset($instance['enablepagenum']) ? $instance['enablepagenum'] : false; $instance['category'] = isset($instance['category'])? $instance['category'] : ""; $show_advanced_option = isset($instance['show_advanced_option']) ? $instance['show_advanced_option'] : false; $layout = apply_filters('widget_layout', empty($instance['layout']) ? '' : $instance['layout']); $spacingtop = apply_filters('widget_spacingtop', empty($instance['spacingtop']) ? '' : $instance['spacingtop']); $spacingbottom = apply_filters('widget_spacingbottom', empty($instance['spacingbottom']) ? '' : $instance['spacingbottom']); $spacingside = apply_filters('widget_spacingside', empty($instance['spacingside']) ? '' : $instance['spacingside']); $border_top = apply_filters('widget_border_top', empty($instance['border_top']) ? '' : $instance['border_top']); $border_bottom = apply_filters('widget_border_bottom', empty($instance['border_bottom']) ? '' : $instance['border_bottom']); $customize_background = isset($instance['customize_background']) ? $instance['customize_background'] : false; $background_image = apply_filters('widget_background_image', empty($instance['background_image']) ? '' : $instance['background_image']); $background_color = apply_filters('widget_background_color', empty($instance['background_color']) ? '' : $instance['background_color']); $background_repeat = apply_filters('widget_background_repeat', empty($instance['background_repeat']) ? '' : $instance['background_repeat']); $background_position = apply_filters('widget_background_position', empty($instance['background_position']) ? '' : $instance['background_position']); $background_attachment = apply_filters('widget_background_attachment', empty($instance['background_attachment']) ? '' : $instance['background_attachment']); $background_size = apply_filters('widget_background_size', empty($instance['background_size']) ? '' : $instance['background_size']); $background_opacity = apply_filters('widget_background_opacity', empty($instance['background_opacity']) ? '' : $instance['background_opacity']); if ( $customclass ) { $before_widget = str_replace('class="', 'class="'. $customclass . ' ', $before_widget); } global $wp_query; ?> '; echo '
'; echo '
'; if( $layout == 'fullwidth'){} else{ echo '
'; } echo '
'; $subtitlewrap =""; if($subtitle){ $subtitlewrap .=''.$subtitle.''; } $titleline=''; if ( $title!='' ) echo $before_title . esc_html($title). $subtitlewrap . $titleline . $after_title; $cols = intval($cols); if(!is_numeric($cols) || $cols < 1 || $cols > 6){ $cols = 4; } $longdesc = (!is_numeric($longdesc) || empty($longdesc))? 0 : $longdesc; $showposts = (!is_numeric($showposts))? get_option('posts_per_page') : $showposts; $categories = $cats; $pagenum = ""; if(!$enablepagenum){$pagenum = 'nopagenum';} echo '
'; $approvedcat = array(); $sideoutput = ""; if( count($categories)!=0 ){ foreach ($categories as $key) { $catname = get_term_by("slug",$key,"category"); $approvedcat[] = $key; } } $approvedcatID = array(); $isotopeclass = ""; if( $display == 'filterable'){ echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo '
'; $isotopeclass = "isotope portfoliolist"; $showposts = -1; }else{ foreach ($categories as $key) { $catname = get_term_by("slug",$key,"category"); $approvedcatID[] = $key; } } wp_reset_query(); if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); $args = array( 'post_type' => 'post', "paged" => $paged, '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 .= '
'; $tpl .= '%%THUMB%%'; $tpl .= '
'; $tpl .= '
'; $tpl .= '
'; $tpl .='

'; $tpl .='%%TITLE%%'; $tpl .='

'; $tpl .='
%%TEXT%%
'; $tpl .= '
'; $tpl .= '
'; $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_price = (isset($custom['custom-price'][0]))? $custom['custom-price'][0] : ""; $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; } //LIGHTBOX URL $custom = get_post_custom($post->ID); $cf_lightboxurl = (isset($custom["lightbox-url"][0]) && $custom["lightbox-url"][0]!="")? $custom["lightbox-url"][0] : ""; if($cf_lightboxurl != ""){ $fullimageurl = $cf_lightboxurl; } $format = get_post_format($post->ID); if(($format=="video")||($format=="audio")){ $lightboxrel = ""; $fullimageurl = get_permalink(); }else{ $lightboxrel = "data-rel=prettyPhoto[mixed]"; } $ids = get_the_ID(); $addclass=""; $catinfos = get_the_terms($post->ID,'category'); $key = ''; $separator = ', '; $quote = '"'; if($catinfos){ foreach($catinfos as $catinfo){ $key .= " ".$catinfo->slug; } $key = trim($key); } //PORTFOLIOID $template = str_replace( '%%ID%%', $post->ID, $template ); //POST-DAY $postday = ''; $postday .= get_the_time( 'd' ); $template = str_replace( '%%DAY%%', $postday, $template ); //POST-MONTH $postmonth = ''; $postmonth .= get_the_time('M'); $template = str_replace( '%%MONTH%', $postmonth, $template ); //POST-YEAR $postyear = ''; $postyear .= get_the_time('Y'); $template = str_replace( '%%YEAR%', $postyear, $template ); //PORTFOLIOCLASS $pfclass = 'item '; $pfclass .= $itemclass.' '; $pfclass .= $key; $template = str_replace( '%%CLASS%%', $pfclass, $template ); //PORTFOLIOKEY $pfkey = $key; $template = str_replace( '%%KEY%%', $pfkey, $template ); //PORTFOLIOFULLIMAGE $pffullimg = $fullimageurl; $template = str_replace( '%%FULLIMG%%', $pffullimg, $template ); //LIGHTBOXREL $pflightbox = $lightboxrel; $template = str_replace( '%%LBOXREL%%', $pflightbox, $template ); //PORTFOLIOIMGTITLE $pffullimgtitle = $cf_customdesc; $template = str_replace( '%%FULLIMGTITLE%%', $pffullimgtitle, $template ); //PORTFOLIOLINK $pflink = get_permalink(); $template = str_replace( '%%LINK%%', $pflink, $template ); //PORTFOLIOIMAGE $pfthumb = ''; if($cf_thumb){ $pfthumb .= '
'.$cf_thumb.'
'; } $template = str_replace( '%%THUMB%%', $pfthumb, $template ); //PRICE $pfprice = ''; $pfprice .= $cf_price; $template = str_replace( '%%PRICE%%', $pfprice, $template ); //TAGS $maintags = ""; $posttags = get_the_tags(); $count=0; if ($posttags) { $maintags .= '
'; foreach($posttags as $tag) { $count++; if (1 == $count) { $maintags .= $tag->name . ' '; } } $maintags .= '
' ; } $template = str_replace( '%%TAG%%', $maintags, $template ); //AllTAGS $alltags = ''; $alltags = get_the_tag_list('
  • ','
  • ','
'); $template = str_replace( '%%ALLTAGS%%', $alltags, $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 .= '
'; if($enablepagenum){ ob_start(); klasik_pagination(); $output .='
'; $output .= '
'.ob_get_contents().'
'; ob_end_clean(); } echo $output; endif; $wp_query = null; $wp_query = $temp; wp_reset_query(); echo '
'; echo '
'; ?>
'; if( $layout == 'fullwidth'){} else{ echo '
'; } echo '
'; echo '
'; echo '
'; echo $after_widget; ?>

'; $returnstring .= ''; $returnstring .= '
'; } $returnstring .= '
'; echo $returnstring; ?>



/>

onchange="showAdvancedOps(this)"/>

class="hidden_options">


class="hidden_options">

onchange="showFeaturedImageOps(this)"/>

class="hidden_options">







__( 'Default', 'klasik' ), 'repeat' => __( 'Repeat', 'klasik' ), 'repeat-x' => __( 'Repeat Horizontal', 'klasik' ), 'repeat-y' => __( 'Repeat Vertical', 'klasik' ), 'no-repeat' => __( 'No Repeat', 'klasik' ) ); } // End get_bg_repeat_options() protected function get_bg_position_options (){ return array( 'default' => __( 'Default', 'klasik' ), 'left' => __( 'Left', 'klasik' ), 'center' => __( 'Center', 'klasik' ), 'right' => __( 'Right', 'klasik' ), 'top left' => __( 'Top', 'klasik' ), 'top center' => __( 'Top Center', 'klasik' ), 'top right' => __( 'Top Right', 'klasik' ), 'bottom left' => __( 'Bottom', 'klasik' ), 'bottom center' => __( 'Bottom Center', 'klasik' ), 'bottom right' => __( 'Bottom Right', 'klasik' ) ); } // End get_bg_position_options() protected function get_bg_attachment_options () { return array( 'default' => __( 'Default', 'klasik' ), 'scroll' => __( 'scroll', 'klasik' ), 'fixed' => __( 'fixed', 'klasik' ) ); } // End get_bg_attachment_options() protected function get_bg_size_options () { return array( 'default' => __( 'Default', 'klasik' ), 'auto' => __( 'auto', 'klasik' ), 'cover' => __( 'cover', 'klasik' ), 'contain' => __( 'contain', 'klasik' ) ); } // End get_bg_attachment_options() protected function get_bg_opacity_options () { return array( 'default' => __( 'Default', 'klasik' ), '0.1' => __( '10%', 'klasik' ), '0.2' => __( '20%', 'klasik' ), '0.3' => __( '30%', 'klasik' ), '0.4' => __( '40%', 'klasik' ), '0.5' => __( '50%', 'klasik' ), '0.6' => __( '60%', 'klasik' ), '0.7' => __( '70%', 'klasik' ), '0.8' => __( '80%', 'klasik' ), '0.9' => __( '90%', 'klasik' ), '1' => __( '100%', 'klasik' ) ); } // End get_bg_opacity_options() protected function get_layout_options () { return array( 'boxed' => __( 'Boxed', 'klasik' ), 'fullwidth' => __( 'Full Width', 'klasik' ) ); } // End get_layout_options() protected function get_display_options () { return array( 'default' => __( 'Default', 'klasik' ), 'filterable' => __( 'Filterable', 'klasik' ) ); } // End get_display_options() protected function get_number_options () { return array( '1' => __( '1 Column', 'klasik' ), '2' => __( '2 Column', 'klasik' ), '3' => __( '3 Column', 'klasik' ), '4' => __( '4 Column', 'klasik' ), '5' => __( '5 Column', 'klasik' ), '6' => __( '6 Column', 'klasik' ) ); } // End get_number_options() } // class Widget