do_action('yit_before_primary'); ?> <!-- START PRIMARY --> <div id="primary" class="<?php yit_sidebar_layout(); ?> "> <div class="inner group"> <?php do_action('yit_before_content'); ?> <!-- START CONTENT --> <div id="content-blog" class="content group"> <?php //yit_debug( yit_get_excluded_categories() ); query_posts('cat=' . yit_get_excluded_categories() . '&posts_per_page=' . get_option('posts_per_page') . '&paged=' . $paged); do_action('yit_loop'); comments_template(); ?> </div> <!-- END CONTENT --> <?php do_action('yit_after_content'); ?> <?php get_sidebar(); ?> <?php do_action('yit_after_sidebar');
function widget( $args, $instance ) { extract( $args ); /* User-selected settings. */ if ( ! isset( $instance['title'] ) ) { $instance['title'] = ''; } $title = apply_filters( 'widget_title', $instance['title'] ); $author = get_the_author_link(); $items = isset( $instance['items'] ) ? $instance['items'] : ''; $more_text = isset( $instance['more_text'] ) ? $instance['more_text'] : ''; $show_thumb = isset( $instance['show_thumb'] ) ? $instance['show_thumb'] : 'yes'; $excerpt_length = isset( $instance['excerpt_length'] ) ? $instance['excerpt_length'] : 10; $date = isset( $instance['date_excerpt'] ) ? $instance['date_excerpt'] : 'no'; $show_comments = isset( $instance ['show_comments'] ) ? $instance['show_comments'] : 'no'; $show_author = isset( $instance ['show_author'] ) && ! empty( $author ) ? $instance['show_author'] : 'no'; $show_excerpt = isset( $instance ['show_excerpt'] ) ? $instance['show_excerpt'] : 'no'; $show_compact = isset( $instance ['show_compact'] ) ? $instance['show_compact'] : 'yes'; echo $before_widget; if ( $title ) echo $before_title . $title . $after_title; $args = array( 'posts_per_page' => $items, 'orderby' => 'date', 'ignore_sticky_posts' => 1 ); $args['order'] = 'DESC'; $excluded_cats = yit_get_excluded_categories( 2 ); if ( ! empty( $excluded_cats ) ) { $args['cat'] = $excluded_cats; } $myposts = new WP_Query( $args ); $html = "\n"; if( 'yes' == $show_compact ){ $html .= '<div class="recent-post group compact">' . "\n"; }else{ $html .= '<div class="recent-post group">' . "\n"; } if ( $myposts->have_posts() ) : while ( $myposts->have_posts() ) : $myposts->the_post(); $wrapper_class = ''; if( 'yes' == $show_thumb && has_post_thumbnail() ){ $wrapper_class .= ' with-thumb'; }else{ $wrapper_class .= ' without-thumb'; } if( 'yes' == $date ){ $wrapper_class .= ' with-date'; }else { $wrapper_class .= ' without-date'; } $img = ''; if ( has_post_thumbnail() && $show_compact == "no" ) { $img = yit_image( "size=blog_section", false ); } elseif ( has_post_thumbnail() && $show_compact == "yes" ){ $img = yit_image( "size=blog_widget_compact", false ); } $html .= '<div class="hentry-post group clearfix">' . "\n"; $html .= '<div class="post-content">'; if ( $date == "yes" ) { $html .= '<p class="post-date">'; $html .= '<span class="day">' . get_the_time( 'd' ) . '</span>'; $html .= '<span class="month">' . get_the_time( 'M' ) . '</span>'; $html .= '</p>'; } if ( $show_thumb == 'yes' && $img != '' ) { $html .= "<div class=\"thumb-img\">" . $img . "</div>\n"; } $html .= '<div class="clearfix text ' . $wrapper_class . '">'; if ( strpos( $more_text, "href='#'" ) ) { $post_readmore = str_replace( "href='#'", "href='" . get_permalink() . "'", str_replace( '"', "'", do_shortcode( $more_text ) ) ); } else { $post_readmore = $more_text; } $html .= the_title( '<h3><a href="' . get_permalink() . '" title="' . get_the_title() . '" class="title">', '</a></h3>', false ); if ( $show_author == "yes" ) { $html .= '<span class="author">' . __( "by", "yit" ) . ' <a href="' . get_author_posts_url( get_the_author_meta( 'ID' ) ) . '">' . get_the_author_link() . ' </a></span>'; } if ( $show_comments == 'yes' ) { $separator = $show_author == 'yes' ? ' / ' : ''; $html .= '<span class="num-comments">' . $separator . ' <a href="' . get_comments_link( get_the_ID() ) . '">' . get_comments_number() . ( get_comments_number() == 1 ? __( ' comment', 'yit' ) : __( ' comments', 'yit' ) ) . '</a></span>'; } if ( $show_excerpt == 'yes' ) { $excerpt = '' . yit_content( 'excerpt', $excerpt_length, $post_readmore ) . ''; if ( $excerpt != '' ) { $html .= $excerpt; } } $html .= '</div></div>' . "\n"; $html .= '</div>' . "\n"; endwhile; endif; wp_reset_query(); $html .= '</div>'; echo $html; add_filter( 'the_content_more_link', 'yit_sc_more_link', 10, 3 ); //shortcode in more links echo $after_widget; }
/** * This file belongs to the YIT Plugin Framework. * * This source file is subject to the GNU GENERAL PUBLIC LICENSE (GPL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.gnu.org/licenses/gpl-3.0.txt */ /** * Template file for show last post of a specific category * * @package Yithemes * @author Francesco Licandro <*****@*****.**> * @since 1.0.0 */ $args = array('post_type' => 'post', 'showposts' => 1, 'cat' => yit_get_excluded_categories(2)); if (isset($cat_name) && !empty($cat_name) && $cat_name != 'null' && $cat_name != "a:0:{}") { $args['category_name'] = $cat_name; } $posts = new WP_Query(); $posts->query($args); $showdate = isset($showdate) && $showdate == 'yes' ? true : false; $showtitle = isset($showtitle) && $showtitle == 'yes' ? true : false; $last = isset($last) && $last == 'yes' ? 'last' : ''; $html = "\n"; while ($posts->have_posts()) { $posts->the_post(); global $more, $post; $more = 0; $img = ''; if (isset($icon) && $icon != '') {
function yit_exclude_categories_list_widget($args) { $cat_args = array('exclude' => str_replace("-", "", yit_get_excluded_categories(2))); return array_merge($args, $cat_args); }
function widget($args, $instance) { extract($args); /* User-selected settings. */ if (!isset($instance['title'])) { $instance['title'] = ''; } $title = apply_filters('widget_title', $instance['title']); $items = isset($instance['items']) ? $instance['items'] : ''; $more_text = isset($instance['more_text']) ? $instance['more_text'] : ''; $show_thumb = isset($instance['show_thumb']) ? $instance['show_thumb'] : 'yes'; $excerpt_length = isset($instance['excerpt_length']) ? $instance['excerpt_length'] : 10; $date = isset($instance['date_excerpt']) ? $instance['date_excerpt'] : 'no'; $show_comments = isset($instance['show_comments']) ? $instance['show_comments'] : 'no'; $show_author = isset($instance['show_author']) ? $instance['show_author'] : 'no'; $excerpt = ''; echo $before_widget; if ($title) { echo $before_title . $title . $after_title; } $args = array('posts_per_page' => $items, 'orderby' => 'date', 'ignore_sticky_posts' => 1); $args['order'] = 'DESC'; $excluded_cats = yit_get_excluded_categories(2); if (!empty($excluded_cats)) { $args['cat'] = $excluded_cats; } $myposts = new WP_Query($args); $html = "\n"; $html .= '<div class="recent-post group">' . "\n"; if ($myposts->have_posts()) { while ($myposts->have_posts()) { $myposts->the_post(); $img = ''; if (has_post_thumbnail()) { $img = get_the_post_thumbnail(get_the_ID(), 'blog_thumb'); } else { $img = '<img src="' . get_template_directory_uri() . '/images/no_image_recentposts.jpg" alt="No Image" />'; } $html .= '<div class="hentry-post group">' . "\n"; if ($show_thumb == 'yes') { $html .= " <div class=\"thumb-img\">{$img}</div>\n"; $html .= '<div class="text">'; } else { $html .= '<div class="text without-thumbnail">'; } if (strpos($more_text, "href='#'")) { $post_readmore = str_replace("href='#'", "href='" . get_permalink() . "'", str_replace('"', "'", do_shortcode($more_text))); } else { $post_readmore = $more_text; } if ($date == "yes") { $html .= '<p class="post-date">'; $html .= '<span class="day">' . get_the_time('d') . '</span>'; $html .= '<span class="month">' . get_the_time('M') . '</span>'; $html .= '</p>'; } else { $excerpt = '' . yit_content('excerpt', $excerpt_length, $post_readmore) . ''; } $html .= the_title('<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="title">', '</a>', false); if (isset($excerpt) && $excerpt != '') { $html .= $excerpt; } if ($show_comments == 'yes') { $html .= '<span class="num-comments">' . get_comments_number() . (get_comments_number() == 1 ? __(' comment', 'yit') : __(' comments', 'yit')) . '</span>'; } if ($show_author == "yes") { $html .= '<span class="author">by ' . '<a href="' . get_author_posts_url(get_the_author_meta('ID')) . '">' . get_the_author_link() . '</a></span>'; } $html .= '</div>' . "\n"; $html .= '</div>' . "\n"; } } wp_reset_query(); $html .= '</div>'; echo $html; add_filter('the_content_more_link', 'yit_sc_more_link', 10, 3); //shortcode in more links echo $after_widget; }