'awp_recent_posts awp_widget', 'description' => __( 'Widget to display recent posts.', 'awp' ), ); $control_ops = array( 'id_base' => 'awp_recent_posts', 'width' => 200, 'height' => 250, ); parent::__construct( 'awp_recent_posts', __( 'AWP Recent Posts', 'awp' ), $widget_ops, $control_ops ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $post_count = $instance['post_count']; // before and after widget arguments are defined by themes echo $args['before_widget']; if ( ! empty( $title ) ) echo $args['before_title']. $title. $args['after_title']; $arg = new WP_Query( array( "posts_per_page" => $post_count, "post_type" => "post", "post_status" => "publish", "order" => "DESC" ) ); global $post; if($arg->have_posts()) { echo '
id="get_field_id('show_image'); ?>" name="get_field_name('show_image'); ?>" />
id="get_field_id('show_date'); ?>" name="get_field_name('show_date'); ?>" />
id="get_field_id('show_author'); ?>" name="get_field_name('show_author'); ?>" />
id="get_field_id('show_category'); ?>" name="get_field_name('show_category'); ?>" />
id="get_field_id('show_comment_number'); ?>" name="get_field_name('show_comment_number'); ?>" />
id="get_field_id('show_excerpt'); ?>" name="get_field_name('show_excerpt'); ?>" />