/** @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']); $linktitle = isset($instance['linktitle']) ? $instance['linktitle'] : false; $category = apply_filters('widget_category', $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']); $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']); $disabletext = false; $instance['category'] = esc_attr(isset($instance['category']) ? $instance['category'] : ""); if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } global $wp_query; $longdesc = !is_numeric($longdesc) || empty($longdesc) ? 0 : $longdesc; $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; $cols = intval($cols); if (!is_numeric($cols) || $cols < 1 || $cols > 6) { $cols = 4; } if ($cols == 1) { $minitems = "0"; $itemwidth = "250"; } elseif ($cols == 2) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 3) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 4) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 5) { $minitems = "2"; $itemwidth = "240"; } elseif ($cols == 6) { $minitems = "2"; $itemwidth = "150"; } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-team-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } $output = ""; $withcarousel = ""; if ($display == 'carousel') { $withcarousel = "carousel-on"; } $output .= '<div class="klasik-team-widget ' . $withcarousel . ' col' . $cols . '">'; $output .= '<div class="row">'; //CAROUSEL if ($display == 'carousel') { if (KLASIK_TEAM_NAV == 'control') { $controlNav = 'true'; $directionNav = 'false'; $UsecontrolNav = 'usecontrolnav'; } elseif (KLASIK_TEAM_NAV == 'directional') { $controlNav = 'false'; $directionNav = 'true'; } elseif (KLASIK_TEAM_NAV == 'both') { $controlNav = 'true'; $directionNav = 'true'; $UsecontrolNav = 'usecontrolnav'; } else { $controlNav = 'false'; $directionNav = 'true'; } $output .= '<div class="klasik-team flexslider-carousel ' . $UsecontrolNav . ' testi-flex-' . $this->get_field_id('klasik-theme-pfilter-widget') . $category . '">'; $output .= '<ul class="slides">'; } if ($cols == 1) { $colclass = "twelve"; } elseif ($cols == 2) { $colclass = "one_half"; } elseif ($cols == 3) { $colclass = "one_third"; } elseif ($cols == 4) { $colclass = "one_fourth"; } elseif ($cols == 5) { $colclass = "one_fifth"; } elseif ($cols == 6) { $colclass = "one_sixth"; } $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $args = array("post_type" => "post", "showposts" => $showposts); if ($category != "") { $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category)); } $wp_query->query($args); global $post; $tpl = '<div id="team-%%ID%%" class="%%CLASS%%">'; $tpl .= '<div class="item-container">'; $tpl .= '<div class="team-image">%%THUMB%%</div>'; $tpl .= '<div class="team-title-container">'; $tpl .= '<h3 class="team-title">%%TITLE%%</h3>'; $tpl .= '<div class="team-tag">%%TAG%%</div>'; $tpl .= '</div>'; $tpl .= '<div class="team-text">%%TEXT%%</div>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div>'; $tpl .= '</div>'; $tpl = apply_filters('klasik_teams_item_template', $tpl); if ($wp_query->have_posts()) { $x = 0; while ($wp_query->have_posts()) { $wp_query->the_post(); //CAROUSEL if ($display == 'carousel') { $template = '<li>' . $tpl . '</li>'; } else { $template = $tpl; } $custom = get_post_custom($post->ID); $cf_thumb = get_the_post_thumbnail($post->ID, 'widget-team', array('class' => ' team-img')); //TEAMID $template = str_replace('%%ID%%', $post->ID, $template); //CLASS if ($cf_thumb) { $withimage = "imageon"; } else { $withimage = "imageoff"; } $x++; if ($x % $cols == 0) { $omega = "omega"; } elseif ($x % $cols == 1) { $omega = "alpha"; } else { $omega = ""; } //CAROUSEL if ($display == 'carousel') { $teamclass = 'titem '; } else { $teamclass = 'titem '; $teamclass .= $colclass . ' columns '; } $teamclass .= 'team' . $x . ' '; $teamclass .= $omega . ' '; $teamclass .= $withimage; $template = str_replace('%%CLASS%%', $teamclass, $template); //MAINIMAGE $mainimg = ''; if ($cf_thumb) { $mainimg .= '<div class="image">' . $cf_thumb . '</div>'; } $template = str_replace('%%THUMB%%', $mainimg, $template); //TITLE $maintitle = ''; if ($linktitle) { $maintitle .= '<a href="' . get_permalink() . '" title="' . get_the_title() . '" >' . get_the_title() . '</a>'; } else { $maintitle .= get_the_title(); } $template = str_replace('%%TITLE%%', $maintitle, $template); //LINK $mainlink = get_permalink(); $template = str_replace('%%LINK%%', $mainlink, $template); //TAGS $maintags = ""; $posttags = get_the_tags(); $count = 0; if ($posttags) { $maintags .= '<div class="tags">'; foreach ($posttags as $tag) { $count++; if (1 == $count) { $maintags .= $tag->name . ' '; } } $maintags .= '</div>'; } $template = str_replace('%%TAG%%', $maintags, $template); //AllTAGS $alltags = ''; $alltags = get_the_tag_list('<ul class="tags"><li>', '</li><li>', '</li></ul>'); $template = str_replace('%%ALLTAGS%%', $alltags, $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); // MAINTEXT $maintext = ''; if (!$disabletext) { if ($longdesc > 0) { $excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc); } else { $excerpt = get_the_excerpt(); } $maintext .= $excerpt; } $template = str_replace('%%TEXT%%', $maintext, $template); $output .= $template; } } $wp_query = null; $wp_query = $temp; wp_reset_query(); //CAROUSEL if ($display == 'carousel') { $output .= '</ul>'; $output .= '</div>'; } $output .= '</div>'; $output .= '<div class="clear"></div>'; $output .= '</div>'; echo do_shortcode($output); ?> <?php if ($display == 'carousel') { ?> <script type="text/javascript"> jQuery(document).ready(function(){ //CAROUSEL jQuery(".testi-flex-<?php echo $this->get_field_id('klasik-theme-pfilter-widget') . $category; ?> ").flexslider({ animation: "slide", touch:true, animationLoop: false, controlNav: <?php echo $controlNav; ?> , directionNav:<?php echo $directionNav; ?> , itemWidth: <?php echo $itemwidth; ?> , itemMargin: 0, minItems: <?php echo $minitems; ?> , maxItems: <?php echo $cols; ?> }); }); </script> <?php } ?> <?php echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }
/** @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']); $category = apply_filters('widget_category', $instance['category']); $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']); $linktitle = isset($instance['linktitle']) ? $instance['linktitle'] : false; $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']); $instance['category'] = esc_attr(isset($instance['category']) ? $instance['category'] : ""); global $wp_query; $longdesc = !is_numeric($longdesc) || empty($longdesc) ? 0 : $longdesc; $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; $cols = intval($cols); if (!is_numeric($cols) || $cols < 1 || $cols > 6) { $cols = 4; } if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-features-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } $output = ""; $output .= '<div class="klasik-features">'; $output .= '<div class="row">'; if ($cols == 1) { $colclass = "twelve"; } elseif ($cols == 2) { $colclass = "one_half"; } elseif ($cols == 3) { $colclass = "one_third"; } elseif ($cols == 4) { $colclass = "one_fourth"; } elseif ($cols == 5) { $colclass = "one_fifth"; } elseif ($cols == 6) { $colclass = "one_sixth"; } $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $args = array("post_type" => "post", "showposts" => $showposts); if ($category != "") { $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category)); } $wp_query->query($args); global $post; $tpl = '<div class="%%CLASS%%" id="f-%%ID%%">'; $tpl .= '<div class="item-container">'; $tpl .= '<div class="feature-title-container">'; $tpl .= '<div class="img-container">%%THUMB%%</div>'; $tpl .= '<h3 class="feature-title">%%TITLE%%</h3>'; $tpl .= '</div>'; $tpl .= '<div class="feature-text">%%TEXT%%</div>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div>'; $tpl .= '</div>'; $tpl = apply_filters('klasik_features_item_template', $tpl); if ($wp_query->have_posts()) { $x = 0; while ($wp_query->have_posts()) { $wp_query->the_post(); $template = $tpl; $custom = get_post_custom($post->ID); $cf_thumb = get_the_post_thumbnail($post->ID, 'widget-feature', array('class' => 'alignleft')); if ($cf_thumb) { $withimage = "imageon"; } else { $withimage = "imageoff"; } $x++; if ($x % $cols == 0) { $omega = "omega"; } elseif ($x % $cols == 1) { $omega = "alpha"; } else { $omega = ""; } //FEATUREID $template = str_replace('%%ID%%', $post->ID, $template); //FEATURECLASS $fclass = 'columns fitem '; $fclass .= $colclass . ' '; $fclass .= 'feature' . $x . ' '; $fclass .= $omega . ' '; $fclass .= $withimage; $template = str_replace('%%CLASS%%', $fclass, $template); //FEATUREIMAGE $fthumb = ''; if ($cf_thumb) { $fthumb .= '<div class="image">' . $cf_thumb . '</div>'; } $template = str_replace('%%THUMB%%', $fthumb, $template); //FEATURELINK $flink = get_permalink(); $template = str_replace('%%LINK%%', $flink, $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); //FEATURETITLE $ftitle = ''; if ($linktitle) { $ftitle .= '<a href="' . get_permalink() . '" title="' . get_the_title() . '" >' . get_the_title() . '</a>'; } else { $ftitle .= get_the_title(); } $template = str_replace('%%TITLE%%', $ftitle, $template); //FEATURETEXT $ftext = ''; if ($longdesc > 0) { $excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc); } else { $excerpt = get_the_excerpt(); } $ftext .= $excerpt; $template = str_replace('%%TEXT%%', $ftext, $template); $output .= $template; } } $wp_query = null; $wp_query = $temp; wp_reset_query(); $output .= '</div>'; $output .= '<div class="clear"></div>'; $output .= '</div>'; echo do_shortcode($output); echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }
/** @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']); $category = apply_filters('widget_category', $instance['category']); $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; $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']); $instance['category'] = esc_attr(isset($instance['category']) ? $instance['category'] : ""); global $wp_query; $longdesc = !is_numeric($longdesc) || empty($longdesc) ? 0 : $longdesc; $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; $cols = intval($cols); if (!is_numeric($cols) || $cols < 1 || $cols > 6) { $cols = 4; } if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-latestnews-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } $pagenum = ""; if (!$enablepagenum) { $pagenum = 'nopagenum'; } $output = ""; $output .= '<div class="klasik-latestnews-widget ' . $pagenum . '">'; $output .= '<div class="row">'; if ($cols == 1) { $colclass = "twelve"; } elseif ($cols == 2) { $colclass = "one_half"; } elseif ($cols == 3) { $colclass = "one_third"; } elseif ($cols == 4) { $colclass = "one_fourth"; } elseif ($cols == 5) { $colclass = "one_fifth"; } elseif ($cols == 6) { $colclass = "one_sixth"; } 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", "ignore_sticky_posts" => true, "paged" => $paged, "showposts" => $showposts); if ($category == 0) { $category = ""; } if ($category != "") { $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category)); } $wp_query->query($args); global $post; $tpl = '<div id="latestpost-%%ID%%" class="%%CLASS%%">'; $tpl .= '<div class="recent-item">'; $tpl .= '<div class="recent-thumb">%%THUMB%%</div>'; $tpl .= '<div class="recent-text-wrap">'; $tpl .= '<h3 class="recent-title"><a href="%%LINK%%">%%TITLE%%</a></h3>'; $tpl .= '<span class="smalldate">%%DATE%%</span>'; $tpl .= '<div class="recent-text">%%TEXT%%</div>'; $tpl .= '</div>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div>'; $tpl .= '</div>'; $tpl = apply_filters('klasik_latestnews_item_template', $tpl); if ($wp_query->have_posts()) { $x = 0; while ($wp_query->have_posts()) { $wp_query->the_post(); $template = $tpl; $custom = get_post_custom($post->ID); $cf_thumb = get_the_post_thumbnail($post->ID, 'widget-latestnews', array('class' => 'alignleft')); if ($cf_thumb) { $withimage = "imageon"; } else { $withimage = "imageoff"; } $x++; if ($x % $cols == 0) { $omega = "omega"; } elseif ($x % $cols == 1) { $omega = "alpha"; } else { $omega = ""; } //POSTID $template = str_replace('%%ID%%', $post->ID, $template); //postformat $postformat = ''; $postformat .= 'format-' . get_post_format($post->ID); $template = str_replace('%%FORMAT%%', $postformat, $template); //POSTCLASS $postclass = 'columns '; $postclass .= $colclass . ' '; $postclass .= $omega . ' '; $postclass .= $withimage; $template = str_replace('%%CLASS%%', $postclass, $template); //POSTTITLE $posttitle = ''; $posttitle .= get_the_title(); $template = str_replace('%%TITLE%%', $posttitle, $template); //TAGS $maintags = ""; $posttags = get_the_tags(); $count = 0; if ($posttags) { $maintags .= '<div class="tags">'; foreach ($posttags as $tag) { $count++; if (1 == $count) { $maintags .= $tag->name . ' '; } } $maintags .= '</div>'; } $template = str_replace('%%TAG%%', $maintags, $template); //AllTAGS $alltags = ''; $alltags = get_the_tag_list('<ul class="tags"><li>', '</li><li>', '</li></ul>'); $template = str_replace('%%ALLTAGS%%', $alltags, $template); //AVATAR $postavatar = ''; $postavatar .= get_avatar(get_the_author_meta('ID')); $template = str_replace('%%AVATAR%%', $postavatar, $template); //POSTDATE $postdate = ''; $postdate .= get_the_time(get_option('date_format')); $template = str_replace('%%DATE%%', $postdate, $template); //POSTCATEGORY $categories = get_the_category(); $separator = apply_filters('klasik_advancedpost_cat_separator', ', '); $atitle = apply_filters('klasik_advancedpost_cat_linktitle', __("View all posts in %s", 'klasik')); $postcat = ''; $i = 0; if ($categories) { foreach ($categories as $category) { $i++; $postcat .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf($atitle, $category->name)) . '">' . $category->cat_name . '</a>'; if ($i != count($categories)) { $postcat .= $separator; } } } $template = str_replace('%%CATEGORY%%', $postcat, $template); //COMMENTS $postcomm = ''; $css_class = 'zero-comments'; $number = (int) get_comments_number(get_the_ID()); if (1 === $number) { $css_class = 'one-comment'; } elseif (1 < $number) { $css_class = 'multiple-comments'; } ob_start(); comments_popup_link(__('No Comments', 'klasik'), __('1 Comment', 'klasik'), __('% Comments', 'klasik'), $css_class, __('Comments Closed', 'klasik')); $postcomm .= '<div class="news-comments ' . $css_class . '">' . ob_get_contents() . '</div>'; ob_end_clean(); $template = str_replace('%%COMMENTS%%', $postcomm, $template); //NUMBERCOMMENTS $number_postcomm = ''; $css_class = 'zero-comments'; $number = (int) get_comments_number(get_the_ID()); if (1 === $number) { $css_class = 'one-comment'; } elseif (1 < $number) { $css_class = 'multiple-comments'; } ob_start(); comments_popup_link(__('0', 'klasik'), __('1', 'klasik'), __('%', 'klasik'), $css_class, __('Closed', 'klasik')); $number_postcomm .= '<div class="news-comments ' . $css_class . '">' . ob_get_contents() . '</div>'; ob_end_clean(); $template = str_replace('%%NUMBERCOMMENTS%%', $number_postcomm, $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); //POSTLINK $postlink = get_permalink(); $template = str_replace('%%LINK%%', $postlink, $template); //POSTAUTHOR $postauthor = get_the_author(); $template = str_replace('%%AUTHOR%%', $postauthor, $template); //POSTAUTHORLINK $postauthorlink = get_author_posts_url(get_the_author_meta('ID')); $template = str_replace('%%AUTHORLINK%%', $postauthorlink, $template); //POSTTHUMB $postthumb = ''; if ($cf_thumb) { $postthumb .= '<div class="image">' . $cf_thumb . '</div>'; } $template = str_replace('%%THUMB%%', $postthumb, $template); //POSTTEXT $posttext = ''; if ($longdesc > 0) { $excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc); } else { $excerpt = get_the_excerpt(); } $posttext .= $excerpt; $template = str_replace('%%TEXT%%', $posttext, $template); $output .= $template; } $output .= '<div class="clear"></div>'; $output .= '</div>'; if ($enablepagenum) { ob_start(); klasik_pagination(); $output .= '<div class="clear"></div>'; $output .= ob_get_contents(); ob_end_clean(); } } $wp_query = null; $wp_query = $temp; wp_reset_query(); $output .= '<div class="clear"></div>'; $output .= '</div>'; echo do_shortcode($output); echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }
/** @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']); $mediaid = apply_filters('widget_mediaid', empty($instance['mediaid']) ? '' : $instance['mediaid']); $imagecols = apply_filters('widget_imagecols', empty($instance['imagecols']) ? '' : $instance['imagecols']); $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']); $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 $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-carousel-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } if ($imagecols == 1) { $colclass = "1"; $minitems = "0"; $itemwidth = "250"; } elseif ($imagecols == 2) { $colclass = "2"; $minitems = "2"; $itemwidth = "250"; } elseif ($imagecols == 3) { $colclass = "3"; $minitems = "2"; $itemwidth = "250"; } elseif ($imagecols == 4) { $colclass = "4"; $minitems = "2"; $itemwidth = "250"; } elseif ($imagecols == 5) { $colclass = "5"; $minitems = "2"; $itemwidth = "240"; } elseif ($imagecols == 6) { $colclass = "6"; $minitems = "2"; $itemwidth = "150"; } else { $colclass = "6"; $minitems = "3"; $itemwidth = "150"; } $cf_imagecarousel = $mediaid; if ($cf_imagecarousel != "") { $include = $cf_imagecarousel; $arrinclude = explode(',', $cf_imagecarousel); $orderby = 'post__in'; $order = 'ASC'; if (count($arrinclude) == 1) { $postobj = get_post($include); $id = $postobj->ID; if ($postobj) { if ($postobj->post_type != 'attachment') { $_attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } } else { $_attachments = array(); } } elseif (count($arrinclude) > 1) { $_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby)); } else { $_attachments = array(); } $attachments = array(); foreach ($_attachments as $key => $val) { $attachments[$val->ID] = $_attachments[$key]; } $tpl = '<li>%%IMAGE%%</li>'; $tpl = apply_filters('klasik_pcarousel_item_template', $tpl); if (count($attachments)) { ?> <div class="klasik-pcarousel flexslider-carousel car-flex-<?php echo $this->get_field_id('klasik-theme-pfilter-widget') . $mediaid; ?> <?php echo 'col' . $imagecols; ?> row"> <ul class="slides"> <?php foreach ($attachments as $id => $attachment) { $template = $tpl; $cf_thumb = wp_get_attachment_image($id, 'widget-carousel', false, false); $image_attributes = wp_get_attachment_image_src($id, 'full', false); // returns an array $alttext = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $image_title = $attachment->post_title; $caption = $attachment->post_excerpt; $description = $attachment->post_content; //IMAGEID $template = str_replace('%%ID%%', $attachment->ID, $template); //IMAGESRC $carothumb = ''; if ($cf_thumb) { $carothumb .= '<div class="image">' . $cf_thumb . '</div>'; } $template = str_replace('%%IMAGE%%', $carothumb, $template); //IMAGETITLE $template = str_replace('%%TITLE%%', $image_title, $template); //IMAGEALT $template = str_replace('%%ALT%%', $alttext, $template); //IMAGECAPTION $template = str_replace('%%CAPTION%%', $caption, $template); //IMAGEDESC $template = str_replace('%%DESC%%', $description, $template); //PORTFOLIOFULLIMAGE $pffullimg = isset($image_attributes[0]) ? $image_attributes[0] : ''; $template = str_replace('%%FULLIMG%%', $pffullimg, $template); echo $template; } ?> </ul> </div> <script type="text/javascript"> jQuery(document).ready(function(){ //Add Class Js to html jQuery('.car-flex-<?php echo $this->get_field_id('klasik-theme-pfilter-widget') . $mediaid; ?> ').flexslider({ animation: "slide", touch:true, animationLoop: false, //smoothHeight: true, controlNav: false, itemWidth: <?php echo $itemwidth; ?> , minItems: <?php echo $minitems; ?> , itemMargin: 0, maxItems: <?php echo $colclass; ?> }); }); </script> <?php } } echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }
/** @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']); $showposts = apply_filters('widget_showpost', empty($instance['showpost']) ? '' : $instance['showpost']); $type = apply_filters('widget_type', empty($instance['type']) ? '' : $instance['type']); $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']); $show_variations = $instance['show_variations'] ? '1' : '0'; $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, $woocommerce; ?> <?php echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-wooproduct-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; //$categories = $cats; echo '<div class="klasik-product woocommerce ' . $customclass . '">'; $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); if ($type == 'latest-product') { $query_args = array('posts_per_page' => $showposts, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product'); $query_args['meta_query'] = array(); if ($show_variations == '0') { $query_args['meta_query'][] = $woocommerce->query->visibility_meta_query(); $query_args['parent'] = '0'; } $query_args['meta_query'][] = $woocommerce->query->stock_status_meta_query(); $query_args['meta_query'] = array_filter($query_args['meta_query']); } elseif ($type == 'featured-product') { $query_args = array('posts_per_page' => $showposts, 'no_found_rows' => 1, 'post_status' => 'publish', 'post_type' => 'product'); $query_args['meta_query'] = $woocommerce->query->get_meta_query(); $query_args['meta_query'][] = array('key' => '_featured', 'value' => 'yes'); } else { $query_args = array('posts_per_page' => $showposts, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'total_sales', 'orderby' => 'meta_value_num', 'no_found_rows' => 1); $query_args['meta_query'] = $woocommerce->query->get_meta_query(); if (isset($instance['hide_free']) && 1 == $instance['hide_free']) { $query_args['meta_query'][] = array('key' => '_price', 'value' => 0, 'compare' => '>', 'type' => 'DECIMAL'); } } $wp_query->query($query_args); global $post; if ($wp_query->have_posts()) { $x = 0; $output = ""; echo '<ul class="row products">'; while ($wp_query->have_posts()) { $wp_query->the_post(); woocommerce_get_template_part('content', 'product'); $x++; } echo '</ul>'; $wp_query = null; $wp_query = $temp; wp_reset_query(); } $wp_query = null; $wp_query = $temp; wp_reset_query(); echo '<div class="clear"></div>'; echo '</div>'; echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; ?> <?php echo $after_widget; ?> <?php }
/** @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; ?> <?php echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-portfolio-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap .= '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; 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; } if ($cols == 1) { $minitems = "0"; $itemwidth = "250"; } elseif ($cols == 2) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 3) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 4) { $minitems = "2"; $itemwidth = "250"; } elseif ($cols == 5) { $minitems = "2"; $itemwidth = "240"; } elseif ($cols == 6) { $minitems = "2"; $itemwidth = "150"; } $longdesc = !is_numeric($longdesc) || empty($longdesc) ? 0 : $longdesc; $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; $categories = $cats; $pagenum = ""; $withcarousel = ""; if (!$enablepagenum) { $pagenum = 'nopagenum'; } if ($display == 'carousel') { $withcarousel = "carousel-on"; } echo '<div class="klasik-portfolio ' . $pagenum . ' ' . $withcarousel . ' col' . $cols . '">'; $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 '<div class="frame-filter">'; echo '<div class="filterlist">'; echo '<ul id="filter" class="controlnav">'; echo '<li class="segment-1 selected-1 current first"><a href="#" data-filter="*">' . __('All Categories', 'klasik') . '</a></li>'; foreach ($categories as $key) { $catname = get_term_by("slug", $key, "category"); echo '<li class="segment-1"><a href="#" class="' . $catname->slug . '" data-filter="' . $catname->slug . '">' . $catname->name . '</a></li>'; $approvedcatID[] = $key; } echo '</ul>'; echo '</div>'; echo '</div>'; echo '<div class="clear"></div>'; $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 = '<div data-id="id-%%ID%%" class="%%CLASS%%" data-type="%%KEY%%">'; $tpl .= '<div class="klasik-pf-img"><div class="shadowBottom">'; $tpl .= '<a class="pfzoom" href="%%FULLIMG%%" %%LBOXREL%% title="%%TITLE%%"><span class="rollover"></span>%%THUMB%%</a>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div></div>'; $tpl .= '<div class="klasik-pf-text">'; $tpl .= '<h3 class="pftitle"><a href="%%LINK%%" title="%%TITLE%%">'; $tpl .= '<span>%%TITLE%%</span>'; $tpl .= '</a></h3>'; $tpl .= '<div class="textcontainer">%%TEXT%%</div>'; $tpl .= '</div>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div>'; $tpl = apply_filters('klasik_pfilter_item_template', $tpl); if ($wp_query->have_posts()) { $x = 0; $output = ""; $output .= '<div class="row ' . $isotopeclass . '">'; //CAROUSEL if ($display == 'carousel') { if (KLASIK_PF_NAV == 'control') { $controlNav = 'true'; $directionNav = 'false'; $UsecontrolNav = 'usecontrolnav'; } elseif (KLASIK_PF_NAV == 'directional') { $controlNav = 'false'; $directionNav = 'true'; $UsecontrolNav = 'nocontrolnav'; } elseif (KLASIK_PF_NAV == 'both') { $controlNav = 'true'; $directionNav = 'true'; $UsecontrolNav = 'usecontrolnav'; } else { $controlNav = 'false'; $directionNav = 'true'; $UsecontrolNav = 'nocontrolnav'; } echo ' <script type="text/javascript"> jQuery(window).load(function() { jQuery(".pf-flex-' . $this->get_field_id("klasik-theme-pfilter-widget") . ''; foreach ($categories as $key) { $catname = get_term_by("slug", $key, "category"); echo $catname->slug; $approvedcatID[] = $key; } echo '").flexslider({ animation: "slide", touch:true, animationLoop: false, smoothHeight: true, controlNav: ' . $controlNav . ', directionNav: ' . $directionNav . ', itemWidth: ' . $itemwidth . ', itemMargin: 0, minItems: ' . $minitems . ', maxItems: ' . $cols . ' }); }); </script>'; $output .= '<div class="klasik-pf flexslider-carousel ' . $UsecontrolNav . ' pf-flex-' . $this->get_field_id('klasik-theme-pfilter-widget'); foreach ($categories as $key) { $catname = get_term_by("slug", $key, "category"); $output .= $catname->slug; $approvedcatID[] = $key; } $output .= '">'; $output .= '<ul class="slides">'; } while ($wp_query->have_posts()) { $wp_query->the_post(); //CAROUSEL if ($display == 'carousel') { $template = '<li>' . $tpl . '</li>'; } else { $template = $tpl; } $custom = get_post_custom($post->ID); $cf_custom_price = isset($custom['custom-price'][0]) ? $custom['custom-price'][0] : ""; $cf_custom_link = isset($custom['custom-link'][0]) ? $custom['custom-link'][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 = ""; } //CAROUSEL if ($display == 'carousel') { $itemclass = ''; } else { $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 = '<img src="' . $portfolioimage . '" alt="" />'; $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; } if ($cf_thumb) { $withimage = "imageon"; } else { $withimage = "imageoff"; } //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 . ' '; $pfclass .= $withimage; $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 if ($cf_custom_link != "") { $pflink = $cf_custom_link; } else { $pflink = get_permalink(); } $template = str_replace('%%LINK%%', $pflink, $template); //PORTFOLIOIMAGE $pfthumb = ''; if ($cf_thumb) { $pfthumb .= '<div class="image">' . $cf_thumb . '</div>'; } $template = str_replace('%%THUMB%%', $pfthumb, $template); //PRICE $pfprice = ''; $pfprice .= $cf_custom_price; $template = str_replace('%%PRICE%%', $pfprice, $template); //TAGS $maintags = ""; $posttags = get_the_tags(); $count = 0; if ($posttags) { $maintags .= '<div class="tags">'; foreach ($posttags as $tag) { $count++; if (1 == $count) { $maintags .= $tag->name . ' '; } } $maintags .= '</div>'; } $template = str_replace('%%TAG%%', $maintags, $template); //AllTAGS $alltags = ''; $alltags = get_the_tag_list('<ul class="tags"><li>', '</li><li>', '</li></ul>'); $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 .= '<a href="' . get_category_link($category->term_id) . '" title="' . esc_attr(sprintf(__("View all posts in %s", 'klasik'), $category->name)) . '">' . $category->cat_name . '</a>' . $separator; } } $template = str_replace('%%CATEGORY%%', trim($pfcat, $separator), $template); $output .= $template; } //CAROUSEL if ($display == 'carousel') { $output .= '</ul>'; $output .= '</div>'; } $output .= '</div>'; if ($display != 'carousel') { if ($enablepagenum) { ob_start(); klasik_pagination(); $output .= '<div class="clear"></div>'; $output .= '<div class="page-numbers-wrapper">' . ob_get_contents() . '</div>'; ob_end_clean(); } } echo $output; } $wp_query = null; $wp_query = $temp; wp_reset_query(); echo '<div class="clear"></div>'; echo '</div>'; ?> <?php echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; ?> <?php }
/** @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']); $buttext1 = apply_filters('widget_buttext1', empty($instance['buttext1']) ? '' : $instance['buttext1']); $buturl1 = apply_filters('widget_buturl1', empty($instance['buturl1']) ? '' : $instance['buturl1']); $text = apply_filters('widget_text', empty($instance['text']) ? '' : $instance['text']); $buttext2 = apply_filters('widget_buttext2', empty($instance['buttext2']) ? '' : $instance['buttext2']); $buturl2 = apply_filters('widget_buturl2', empty($instance['buturl2']) ? '' : $instance['buturl2']); $customclass = apply_filters('widget_customclass', empty($instance['customclass']) ? '' : $instance['customclass']); $linkbut = isset($instance['linkbut']) ? $instance['linkbut'] : false; $wpautop = isset($instance['wpautop']) ? $instance['wpautop'] : false; $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']); $disabletext = false; if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-action-widget-wrapper" style="' . $spacing_left_right . '">'; $output = ""; $output .= '<div class="klasik-action-widget">'; $tpl = '<div class="item-container">'; $tpl .= '%%TITLE%% %%SUBTITLE%% %%TEXT%%'; $tpl .= '<div class="action-button">%%BUTTON1%% %%BUTTON2%%</div>'; $tpl .= '<div class="clear"></div>'; $tpl .= '</div>'; $tpl = apply_filters('klasik_actions_item_template', $tpl); $template = $tpl; //TITLE $maintitle = ''; if ($title) { $maintitle .= '<h1>' . $title . '</h1>'; } $template = str_replace('%%TITLE%%', $maintitle, $template); //SUBTITLE $maintitle = ''; if ($subtitle) { $maintitle .= '<h2>' . $subtitle . '</h2>'; } $template = str_replace('%%SUBTITLE%%', $maintitle, $template); // MAINTEXT $maintext = ''; if ($text) { if ($wpautop == "on") { $text = wpautop($text); } $maintext .= '<div class="text">' . $text . '</div>'; } $template = str_replace('%%TEXT%%', $maintext, $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); // BUTTON1 $mainbuttext1 = ''; if ($linkbut) { $external = 'target="_blank"'; } else { $external = ''; } if ($buttext1) { $mainbuttext1 .= '<a href="' . $buturl1 . '" title="' . $buttext1 . '" ' . $external . ' class="button left">' . $buttext1 . '</a>'; } $template = str_replace('%%BUTTON1%%', $mainbuttext1, $template); // BUTTON2 $mainbuttext2 = ''; if ($linkbut) { $external = 'target="_blank"'; } else { $external = ''; } if ($buttext2) { $mainbuttext2 .= '<a href="' . $buturl2 . '" title="' . $buttext2 . '" ' . $external . ' class="button right">' . $buttext2 . '</a>'; } $template = str_replace('%%BUTTON2%%', $mainbuttext2, $template); $output .= $template; $output .= '<div class="clear"></div>'; $output .= '</div>'; echo do_shortcode($output); echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }
/** @see WP_Widget::widget */ function widget($args, $instance) { extract($args); $title = isset($instance['title']) ? $instance['title'] : false; $subtitle = isset($instance['subtitle']) ? $instance['subtitle'] : false; $id = (int) $instance['page_id']; $block = get_post($id); $wpautop = isset($instance['wpautop']) ? $instance['wpautop'] : false; $customclass = empty($instance['customclass']) ? '' : $instance['customclass']; $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']); $block_content = $block->post_content; if ($wpautop == "on") { $block_content = wpautop($block_content); } if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } ?> <?php echo $before_widget; ?> <?php $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-pageinwidget-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } ?> <div class="text-block <?php echo $block->post_name; ?> "> <?php $output = apply_filters('text_blocks_widget_html', $block_content); echo do_shortcode($output); ?> </div> <?php echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; ?> <?php }
/** @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']); $category = apply_filters('widget_category', $instance['category']); $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']); $disableimage = isset($instance['disableimage']) ? $instance['disableimage'] : false; $disabledate = isset($instance['disabledate']) ? $instance['disabledate'] : false; $disabletext = isset($instance['disabletext']) ? $instance['disabletext'] : false; $disablemore = isset($instance['disablemore']) ? $instance['disablemore'] : false; $readmoretext = apply_filters('widget_readmoretext', empty($instance['readmoretext']) ? '' : $instance['readmoretext']); $orderby = apply_filters('widget_orderby', empty($instance['orderby']) ? '' : $instance['orderby']); $order = apply_filters('widget_order', empty($instance['order']) ? '' : $instance['order']); $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']); $instance['category'] = esc_attr(isset($instance['category']) ? $instance['category'] : ""); global $wp_query; $longdesc = !is_numeric($longdesc) || empty($longdesc) ? 0 : $longdesc; $showposts = !is_numeric($showposts) ? get_option('posts_per_page') : $showposts; $cols = intval($cols); if (!is_numeric($cols) || $cols < 1 || $cols > 6) { $cols = 4; } if ($customclass) { $before_widget = str_replace('class="', 'class="' . $customclass . ' ', $before_widget); } echo $before_widget; $spacing_left_right = ''; $spacing_top_bottom = ''; $border = ''; if ($show_advanced_option) { if ($border_top) { $border .= 'border-top:' . $border_top . '; '; } if ($border_bottom) { $border .= 'border-bottom:' . $border_bottom . '; '; } if ($spacingtop) { $spacing_top_bottom .= 'padding-top:' . $spacingtop . '; '; } if ($spacingbottom) { $spacing_top_bottom .= 'padding-bottom:' . $spacingbottom . '; '; } if ($spacingside) { $spacing_left_right .= 'padding-left:' . $spacingside . '; '; $spacing_left_right .= 'padding-right:' . $spacingside . '; '; } } $bgcolor_rgba = ''; $bgopacity = ''; if ($background_opacity != "default") { $bgopacity = $background_opacity; } $klasik_color = $background_color; $rgb = klasik_hex2rgba($klasik_color); $rgba = klasik_hex2rgba($klasik_color, $bgopacity); $background = ''; if ($customize_background) { if ($background_color) { $bgcolor_rgba = 'background-color:' . $rgba . '; '; } if ($background_image) { $background .= 'background-image:url(' . $background_image . '); '; } if ($background_repeat != "default") { $background .= 'background-repeat:' . $background_repeat . '; '; } if ($background_position != "default") { $background .= 'background-position:' . $background_position . '; '; } if ($background_attachment != "default") { $background .= 'background-attachment:' . $background_attachment . '; '; } if ($background_size != "default") { $background .= 'background-size:' . $background_size . '; '; } } $layoutcss = ''; if ($layout == 'fullwidth') { $layoutcss = 'fullwidth'; } else { $layoutcss = 'boxed'; } echo '<div class="all-widget-container ' . $layoutcss . '" style="' . $background . ' ' . $border . ' ">'; echo '<div class="opacity" style="' . $bgcolor_rgba . '">'; echo '<div class="all-widget-wrapper" style="' . $spacing_top_bottom . '">'; if ($layout == 'fullwidth') { } else { echo ' <div class="container"> <div class="row"> <div class="twelve columns"> '; } echo '<div class="klasik-recentpost-widget-wrapper" style="' . $spacing_left_right . '">'; $subtitlewrap = ""; if ($subtitle) { $subtitlewrap = '<span class="widget-subtitle-wrap"><span class="widget-subtitle">' . $subtitle . '</span><span class="line"></span></span>'; } $titleline = '<span class="line-wrap"><span class="line"></span></span>'; if ($title != '') { echo $before_title . esc_html($title) . $subtitlewrap . $titleline . $after_title; } $output = ""; $output .= '<div class="klasik-recentpost-widget ' . $customclass . '">'; $output .= '<div class="row">'; if ($cols == 1) { $colclass = "twelve"; } elseif ($cols == 2) { $colclass = "one_half"; } elseif ($cols == 3) { $colclass = "one_third"; } elseif ($cols == 4) { $colclass = "one_fourth"; } elseif ($cols == 5) { $colclass = "one_fifth"; } elseif ($cols == 6) { $colclass = "one_sixth"; } $temp = $wp_query; $wp_query = null; $wp_query = new WP_Query(); $args = array("post_type" => "post", "ignore_sticky_posts" => true, "showposts" => $showposts, "orderby" => $orderby, "order" => $order); if ($category == 0) { $category = ""; } if ($category != "") { $args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $category)); } $wp_query->query($args); global $post; if ($wp_query->have_posts()) { $x = 0; while ($wp_query->have_posts()) { $wp_query->the_post(); $custom = get_post_custom($post->ID); $cf_thumb = get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'alignleft')); $x++; if ($x % $cols == 0) { $omega = "omega"; } elseif ($x % $cols == 1) { $omega = "alpha"; } else { $omega = ""; } $output .= '<div class="' . $colclass . ' columns ' . $omega . '">'; $output .= '<div class="recent-item">'; $custom = get_post_custom($post->ID); if (has_post_thumbnail($post->ID)) { $thumb = get_the_post_thumbnail($post->ID, 'widget-post', array('class' => 'frame')); } else { $thumb = ""; } if ($thumb != "" && !$disableimage) { $output .= '<div class="recent-thumb">' . $thumb . '</div>'; } $output .= '<h3 class="recent-title"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h3>'; if (!$disabledate) { $output .= '<span class="smalldate">' . get_the_date() . '</span>'; } $output .= '<div class="sep"></div>'; if (!$disabletext) { $output .= '<div class="recent-text">'; if ($longdesc > 0) { $excerpt = klasik_string_limit_char(get_the_excerpt(), $longdesc); } else { $excerpt = get_the_excerpt(); } $output .= $excerpt; $output .= '</div>'; } if (!$disablemore) { $output .= '<div class="recent-link">'; if ($readmoretext == '') { $moretext = __('Read More', 'klasik'); } else { $moretext = $readmoretext; } $output .= '<a href="' . get_permalink() . '" class="more-link">' . $moretext . '</a>'; $output .= '</div>'; } $output .= '<div class="clear"></div>'; $output .= '</div>'; $output .= '</div>'; } } $wp_query = null; $wp_query = $temp; wp_reset_query(); $output .= '</div>'; $output .= '<div class="clear"></div>'; $output .= '</div>'; echo do_shortcode($output); echo '<div class="clear"></div></div>'; if ($layout == 'fullwidth') { } else { echo ' </div> </div> </div>'; } echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo '<div class="clear"></div></div>'; echo $after_widget; }