'widget_recent_entries_thumbnail widget_thumbnail', 'description' => __( 'Your site\'s most recent Posts along with thumbnail.', 'bulan' ) ); // Create the widget. parent::__construct( 'bulan-recent', // $this->id_base __( 'Recent Posts Thumbnails', 'bulan' ), // $this->name $widget_options // $this->widget_options ); } /** * Outputs the widget based on the arguments input through the widget controls */ function widget( $args, $instance ) { extract( $args ); // Output the theme's $before_widget wrapper. echo $before_widget; // If the title not empty, display it. if ( $instance['title'] ) { echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; } // Posts query arguments. $args = array( 'post_type' => 'post', 'posts_per_page' => $instance['limit'] ); // The post query $recent = new WP_Query( $args ); global $post; if ( $recent->have_posts() ) { echo ''; } // Reset the query. wp_reset_postdata(); // Close the theme's widget wrapper. echo $after_widget; } /** * Updates the widget control options for the particular instance of the widget */ function update( $new_instance, $old_instance ) { $instance = $new_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['limit'] = (int) $new_instance['limit']; $instance['show_date'] = isset( $new_instance['show_date'] ) ? (bool) $new_instance['show_date'] : false; return $instance; } /** * Displays the widget control options in the Widgets admin screen */ function form( $instance ) { // Default value. $defaults = array( 'title' => esc_html__( 'Recent Posts', 'bulan' ), 'limit' => 5, 'show_date' => false ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

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