function widget($args, $instance) { extract($args); /* User-selected settings. */ $title = apply_filters('widget_title', $instance['title']); $category = $instance['category']; $show_count = $instance['show_count']; $show_date = $instance['show_date'] ? true : false; $show_thumb = $instance['show_thumb'] ? true : false; $show_excerpt = $instance['show_excerpt'] ? true : false; $excerpt_length = $instance['excerpt_length']; $show_title = $instance['hide_title'] ? false : true; /* Before widget (defined by themes). */ echo $before_widget; /* Title of widget (before and after defined by themes). */ if ($title) { echo $before_title . $title . $after_title; } echo '<ul class="feature-posts-list">'; $query_opts = apply_filters('wpzoom_query', array('posts_per_page' => $show_count, 'post_type' => 'post')); if ($category) { $query_opts['cat'] = $category; } query_posts($query_opts); if (have_posts()) { while (have_posts()) { the_post(); echo '<li>'; if ($show_thumb && has_post_thumbnail()) { echo '<a href="' . get_permalink() . '"><img src="' . ui::thumbIt(absint(get_post_thumbnail_id()), absint($instance['thumb_width']), absint($instance['thumb_height'])) . '" height="' . $instance['thumb_height'] . '" width="' . $instance['thumb_width'] . '"></a>'; } if ($show_title) { echo '<a href="' . get_permalink() . '">' . get_the_title() . '</a> <br />'; } if ($show_date) { echo '<small>' . get_the_date() . '</small> <br />'; } if ($show_excerpt) { $the_excerpt = get_the_excerpt(); // cut to character limit $the_excerpt = substr($the_excerpt, 0, $excerpt_length); // cut to last space $the_excerpt = substr($the_excerpt, 0, strrpos($the_excerpt, ' ')); echo '<span class="post-excerpt">' . $the_excerpt . '</span>'; } echo '<div class="clear"></div></li>'; } } else { } //Reset query_posts wp_reset_query(); echo '</ul><div class="clear"></div>'; /* After widget (defined by themes). */ echo $after_widget; }