'agency_ecommerce_widget_latest_news', 'description' => esc_html__('Widget to dispaly latest posts with thumbnail, title, short content and read more link', 'agency-ecommerce'), ); parent::__construct('agency-ecommerce-latest-news', esc_html__('AE: Latest News', 'agency-ecommerce'), $opts); } function widget($args, $instance) { $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); $post_category = !empty($instance['post_category']) ? $instance['post_category'] : 0; $exclude_categories = !empty($instance['exclude_categories']) ? esc_attr($instance['exclude_categories']) : ''; $excerpt_length = !empty($instance['excerpt_length']) ? $instance['excerpt_length'] : 15; $disable_date = !empty($instance['disable_date']) ? $instance['disable_date'] : 0; echo $args['before_widget']; ?>
3, 'no_found_rows' => true, 'post__not_in' => get_option('sticky_posts'), 'ignore_sticky_posts' => true, ); if (absint($post_category) > 0) { $query_args['cat'] = absint($post_category); } if (!empty($exclude_categories)) { $exclude_ids = explode(',', $exclude_categories); $query_args['category__not_in'] = $exclude_ids; } $all_posts = new WP_Query($query_args); if ($all_posts->have_posts()) : ?>
post_count; while ($all_posts->have_posts()) : $all_posts->the_post(); ?>
'', 'post_category' => '', 'exclude_categories' => '', 'excerpt_length' => 15, 'disable_date' => 0, )); ?>

'name', 'hide_empty' => 0, 'class' => 'widefat', 'taxonomy' => 'category', 'name' => $this->get_field_name('post_category'), 'id' => $this->get_field_id('post_category'), 'selected' => absint($instance['post_category']), 'show_option_all' => esc_html__('All Categories', 'agency-ecommerce'), ); wp_dropdown_categories($cat_args); ?>

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