/** @see WP_Widget::widget */
    function widget($args, $instance)
    {
        extract($args);
        $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title']);
        $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;
        $text = isset($instance['text']) ? $instance['text'] : false;
        $wpautop = isset($instance['wpautop']) ? $instance['wpautop'] : false;
        $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;
        echo '
					    <div class="all-widget-wrapper">
                		<div class="container">
                    	<div class="row">
                        <div class="twelve columns">
					 ';
        echo '<div class="klasik-features-widget-wrapper">';
        $titleline = '<span class="line-wrap-title"><span class="line-title"></span></span>';
        if ($title != '') {
            echo $before_title . esc_html($title) . $titleline . $after_title;
        }
        $output = "";
        // Echo the text
        if ($text) {
            if ($wpautop == "on") {
                $text = wpautop($text);
            }
            $output .= '<div class="features-text">' . $text . '</div>';
        }
        $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);
                $mt_icon = klasik_get_metabox('klasik_icon');
                $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 ($mt_icon) {
                    $fthumb .= '<div class="image"><i class="fa ' . $mt_icon . ' "></i></div>';
                } else {
                    $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>';
        echo '                        
					</div>
					</div>
					</div>
					<div class="clear"></div></div>';
        echo $after_widget;
    }
Ejemplo n.º 2
0
						<?php 
$sidebarposition = klasik_get_option('klasik_sidebar_position', 'two-col-left');
if (is_home()) {
    $pid = get_option('page_for_posts');
} else {
    $pid = '';
}
$custom_fields = klasik_get_customdata($pid);
$pagelayout = $sidebarposition;
if (klasik_get_metabox('klasik_layout') && klasik_get_metabox('klasik_layout') != 'default' && is_search() != 'default') {
    $pagelayout = klasik_get_metabox('klasik_layout');
}
?>
						
                        		<div class="clear"></div>
                            </div><!-- main -->
                            
                            <?php 
if (is_active_sidebar('contentbottom')) {
    ?>
							<div class="row">
								<div class="twelve columns">
                                    <div class="custom-position contentbottom-container">
                                        <?php 
    if (!dynamic_sidebar('contentbottom')) {
    }
    ?>
                                        <div class="clear"></div>
                                    </div>
                                </div>
							</div>
Ejemplo n.º 3
0
" <?php 
    echo klasik_page_image();
    ?>
>
                <div class="container">
                    <div class="row">
                        <div class="twelve columns">
                            <div id="afterheader">
                            	<div id="page-title-wrap">
                                <?php 
    klasik_page_title();
    ?>
                                
								<?php 
    $custom = klasik_get_customdata();
    $cf_disablemeta = klasik_get_metabox('klasik_disable_meta');
    if (is_single() && !$cf_disablemeta && function_exists('is_woocommerce') && !is_woocommerce()) {
        ?>
                                    <div class="entry-utility">
                                        <div class="date"> <?php 
        the_time(get_option('date_format'));
        ?>
</div>  
                                        <span class="text-sep text-sep-date">/</span>
                                        <div class="user">
										<?php 
        _e('by', 'klasik');
        ?>
 <a href="<?php 
        echo get_author_posts_url(get_the_author_meta('ID'));
        ?>
 function klasik_page_title()
 {
     //custom meta field
     $custom = klasik_get_customdata();
     $mt_icon = klasik_get_metabox('klasik_icon');
     $faicontitle = '';
     if ($mt_icon) {
         $faicontitle = '<span class="fa-icon-title"><i class="fa ' . $mt_icon . ' "></i></span> ';
     }
     if (is_singular('portfolio') || is_attachment()) {
         $titleoutput = '<h1 class="pagetitle nodesc">' . get_the_title() . '</h1>';
         echo $titleoutput;
     } elseif (is_single()) {
         $titleoutput = $faicontitle . '<h1 class="pagetitle nodesc">' . get_the_title() . '</h1>';
         echo $titleoutput;
     } elseif (function_exists('is_woocommerce') && is_woocommerce()) {
         echo '<h1 class="pagetitle nodesc">';
         woocommerce_page_title();
         echo '</h1>';
     } elseif (is_archive()) {
         echo '<h1 class="pagetitle nodesc">';
         if (is_day()) {
             printf(__('Daily Archives <span>%s</span>', 'klasik'), get_the_date());
         } elseif (is_month()) {
             printf(__('Monthly Archives <span>%s</span>', 'klasik'), get_the_date('F Y'));
         } elseif (is_year()) {
             printf(__('Yearly Archives <span>%s</span>', 'klasik'), get_the_date('Y'));
         } elseif (is_author()) {
             printf(__('Author Archives %s', 'klasik'), "<a class='url fn n' href='" . get_author_posts_url(get_the_author_meta('ID')) . "' title='" . esc_attr(get_the_author()) . "' rel='me'>" . get_the_author() . "</a>");
         } else {
             printf(__('%s', 'klasik'), '<span>' . single_cat_title('', false) . '</span>');
         }
         echo '</h1>';
         if (category_description(get_cat_ID(single_cat_title('', false)))) {
             echo '<span class="pagedesc">' . category_description(get_cat_ID(single_cat_title('', false))) . '</span>';
         }
     } elseif (is_search()) {
         echo '<h1 class="pagetitle nodesc">';
         printf(__('Search Results for %s', 'klasik'), '<span>' . get_search_query() . '</span>');
         echo '</h1>';
     } elseif (is_404()) {
         echo ' <h1 class="pagetitle nodesc">';
         _e('404 Page', 'klasik');
         echo '</h1>';
     } elseif (is_home()) {
         $homeid = get_option('page_for_posts');
         echo '<h1 class="pagetitle nodesc">';
         echo $homeid ? get_the_title($homeid) : __('Latest Posts', 'klasik');
         echo '</h1>';
     } else {
         if (have_posts()) {
             while (have_posts()) {
                 the_post();
                 $titleoutput = '';
                 $titleoutput .= $faicontitle . '<h1 class="pagetitle">' . get_the_title() . '</h1>';
                 echo $titleoutput;
                 global $post;
                 if ($post->post_excerpt) {
                     echo '<span class="pagedesc">' . get_the_excerpt() . '</span>';
                 }
             }
         }
         wp_reset_query();
     }
 }