'widget_recent_entries', 'description' => esc_html__( "The most recent posts on your site","bigc") ); parent::__construct('recent-posts', esc_html__('Recent Posts',"bigc"), $widget_ops); $this->alt_option_name = 'widget_recent_entries'; // add_action( 'save_post', array($this, 'flush_widget_cache') ); // add_action( 'deleted_post', array($this, 'flush_widget_cache') ); // add_action( 'switch_theme', array($this, 'flush_widget_cache') ); } function widget($args, $instance) { $cache = wp_cache_get('widget_recent_posts', 'widget'); if ( !is_array($cache) ) $cache = array(); if ( ! isset( $args['widget_id'] ) ) $args['widget_id'] = $this->id; if ( isset( $cache[ $args['widget_id'] ] ) ) { echo esc_attr($cache[ $args['widget_id'] ]); return; } ob_start(); extract($args); $title = ( ! empty( $instance['title'] ) ) ? $instance['title'] : esc_html__( 'Recent Posts',"bigc"); $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $number = ( ! empty( $instance['number'] ) ) ? absint( $instance['number'] ) : 10; if ( ! $number ) $number = 10; $show_date = isset( $instance['show_date'] ) ? $instance['show_date'] : false; $r = new WP_Query( apply_filters( 'widget_posts_args', array( 'posts_per_page' => $number, 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => true ) ) ); if ($r->have_posts()) : ?>
id="get_field_id( 'show_date' )); ?>" name="get_field_name( 'show_date' )); ?>" />