'bloggernewspaper_post_carousel', 'description' => __('(blog carousel style) Displays latest posts or posts from a choosen category.', 'blogger-newspaper'), 'customize_selective_refresh' => true, ); parent::__construct('bloggernewspaper-latestpost-carousel', __('♥ bloggernewspaper-Post Carousel', 'blogger-newspaper'), $widget_ops); $this->alt_option_name = 'bloggernewspaper_latestpost_carousel'; } /** * Display Widget * * @param $args * @param $instance */ function widget($args, $instance) { extract($args); $number_posts = (!empty($instance['number_posts'])) ? absint($instance['number_posts']) : 3; if (!$number_posts) { $number_posts = 3; } $sticky_posts = isset($instance['sticky_posts']) ? $instance['sticky_posts'] : false; $auto_play = (!empty($instance['auto_play'])) ? wp_kses_post($instance['auto_play']) : 'true'; $slidesto_show = (!empty($instance['slidesto_show'])) ? absint($instance['slidesto_show']) : 3; if (!$slidesto_show) { $slidesto_show = 3; } $hide_autor_date = (isset($instance['hide_autor_date'])) ? $instance['hide_autor_date'] : false; $category = (isset($instance['category'])) ? absint($instance['category']) : ''; // Latest Posts 1 if (true == $sticky_posts) : $sticky = get_option('sticky_posts'); else : $sticky = ''; endif; $latest_bloglist_posts = new WP_Query( array( 'cat' => $category, 'posts_per_page' => $number_posts, 'post_status' => 'publish', 'post__not_in' => $sticky, ) ); echo $before_widget; ?>

have_posts()) : ?> have_posts()) : $latest_bloglist_posts->the_post(); ?>
'show_option_all', 'title' => 'Latest Blog ', 'auto_play' => 'true', ); $instance = wp_parse_args((array) $instance, $defaults); $number_posts = isset($instance['number_posts']) ? absint($instance['number_posts']) : 5; $slidesto_show = isset($instance['slidesto_show']) ? absint($instance['slidesto_show']) : 3; $hide_autor_date = isset($instance['hide_autor_date']) ? (bool) $instance['hide_autor_date'] : false; $sticky_posts = isset($instance['sticky_posts']) ? (bool) $instance['sticky_posts'] : false; ?>

'Show all posts', 'orderby' => 'ID', 'order' => 'ASC', 'show_count' => 1, 'hide_empty' => 1, 'selected' => $instance['category'], 'hierarchical' => 0, 'name' => $this->get_field_name('category'), 'taxonomy' => 'category', 'value_field' => 'term_id', ); ?>

id="get_field_id('sticky_posts'); ?>" name="get_field_name('sticky_posts'); ?>" />

id="get_field_id('hide_autor_date'); ?>" name="get_field_name('hide_autor_date'); ?>" />