__( '(News style) Displays latest posts or posts from a choosen category. ', 'best-blog' ), 'customize_selective_refresh' => true, ) ); } /** * Display Widget * * @param $args * @param $instance */ function widget($args, $instance) { extract($args); $number_posts = ( ! empty( $instance['number_posts'] ) ) ? absint( $instance['number_posts'] ) : 3; $sticky_posts = ( isset( $instance['sticky_posts'] ) ) ? $instance['sticky_posts'] : true; $category = ( isset( $instance['category'] ) ) ? absint( $instance['category'] ) : ''; $viewall_text = ( ! empty( $instance['viewall_text'] ) ) ? $instance['viewall_text'] : ''; // Latest Posts 1 $latest_big_posts = new WP_Query( array( 'cat' => $category, 'posts_per_page' => 1, 'post_status' => 'publish', 'ignore_sticky_posts' => $sticky_posts, ) ); echo $before_widget; ?>
$this->get_field_name('category'), 'selected' => $instance['category'], 'show_option_all' => 'Show all posts' ) ); ?>
class="checkbox" id="get_field_id('sticky_posts'); ?>" name="get_field_name('sticky_posts'); ?>" />