'bloggernewspaper_latest_post_blog_grid', 'description' => __('(BLOG POST grid STYLE ) Displays latest posts or posts from a choosen category', 'blogger-newspaper'), 'customize_selective_refresh' => true, ); parent::__construct('latest-post-grid', __('♥ Newspaperss - Blog Grid', 'blogger-newspaper'), $widget_ops); $this->alt_option_name = 'bloggernewspaper_post_grid'; } /** * Display Widget * * @param $args * @param $instance */ function widget($args, $instance) { extract($args); $number_posts = (!empty($instance['number_posts'])) ? absint($instance['number_posts']) : 4; if (!$number_posts) { $number_posts = 4; } $sticky_posts = isset($instance['sticky_posts']) ? $instance['sticky_posts'] : false; $category = (isset($instance['category'])) ? absint($instance['category']) : ''; $hide_posts_cat = (isset($instance['hide_posts_cat'])) ? $instance['hide_posts_cat'] : false; $hide_autor_date = (isset($instance['hide_autor_date'])) ? $instance['hide_autor_date'] : false; $show_post_row = (!empty($instance['show_post_row'])) ? wp_kses_post($instance['show_post_row']) : 'large-6'; // Latest Posts 1 if ($sticky_posts) : $sticky = get_option('sticky_posts'); else : $sticky = ''; endif; $latest_blog_posts_grid = new WP_Query( array( 'cat' => $category, 'posts_per_page' => $number_posts, 'post_status' => 'publish', 'post__not_in' => $sticky, ) ); echo $before_widget; ?>
$this->get_field_name('category'), 'selected' => $instance['category'], 'show_option_all' => 'Show all posts')); ?>
id="get_field_id('sticky_posts'); ?>" name="get_field_name('sticky_posts'); ?>" />
id="get_field_id('hide_posts_cat'); ?>" name="get_field_name('hide_posts_cat'); ?>" />
id="get_field_id('hide_autor_date'); ?>" name="get_field_name('hide_autor_date'); ?>" />