'business_brand_slider_2_widget_recent_posts_template_slider', 'description' => esc_html__("The most recent posts on your site", 'business-brand')); parent::__construct('recent-posts-template_slider', esc_html__('BX : Post Slider Style 1', 'business-brand'), $widget_ops); $this->alt_option_name = 'widget_recent_entries_template_slider'; add_action('save_post', array($this, 'business_brand_slider_2_flush_widget_cache_template2')); add_action('deleted_post', array($this, 'business_brand_slider_2_flush_widget_cache_template2')); add_action('switch_theme', array($this, 'business_brand_slider_2_flush_widget_cache_template2')); } function widget($args, $instance) { wp_enqueue_script( 'business-brand-post-slider-style-2', get_template_directory_uri().'/inc/widgets/business-brand-latest-post-slider2/slider2.js',array('jquery'),null, false); $business_brand_slider_2_cache = wp_cache_get('business_brand_slider_2_widget_recent_posts_template_slider', 'widget'); if (!is_array($business_brand_slider_2_cache)) $business_brand_slider_2_cache = array(); if (!isset($args['widget_id'])) $args['widget_id'] = $this->id; if (isset($business_brand_slider_2_cache[$args['widget_id']])) { echo esc_attr($business_brand_slider_2_cache[$args['widget_id']]); return; } ob_start(); extract($args); $category_list = isset($instance['category']) ? absint($instance['category']) : ''; $number = isset($instance['number']) ? absint($instance['number']) : ''; ?> $number, 'category__in' => $category_list, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true))); if ($business_brand_slider_2_r->have_posts()) : echo $args['before_widget']; ?> business_brand_slider_2_flush_widget_cache_template2(); $alloptions = wp_cache_get('alloptions', 'options'); if (isset($alloptions['business_brand_slider_2_widget_recent_posts_template_slider'])) delete_option('business_brand_slider_2_widget_recent_posts_template_slider'); return $instance; } function business_brand_slider_2_flush_widget_cache_template2() { wp_cache_delete('business_brand_slider_2_widget_recent_posts_template_slider', 'widget'); } function form($instance) { $category_list = isset($instance['category']) ? absint($instance['category']) : ''; $number = isset($instance['number']) ? absint($instance['number']) : 10; ?>

' Select', 'name' => $this->get_field_name('category'), 'selected' => $category_list)); ?>