esc_html__( 'Displays Posts.', 'alpha-blog' ), ) ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $posts_no = !empty( $instance[ 'post_no' ] ) ? $instance[ 'post_no' ] : 4; $layout = !empty( $instance[ 'layout' ] ) ? $instance[ 'layout' ] : 'layout_one'; $post_type = !empty( $instance[ 'post_type' ] ) ? $instance[ 'post_type' ] : 'recent_post'; $post_content = !empty( $instance[ 'post_content' ] ) ? $instance[ 'post_content' ] : 'display_time'; $post_args = array( 'post_type' => 'post' ); if( $post_type == 'popular_post' ) { $post_args['orderby'] = 'comment_count'; } if( absint( $posts_no ) > 0 ) { $post_args['posts_per_page'] = absint( $posts_no ); } $post_query = new WP_Query( $post_args ); if( $post_query->have_posts() ) { if( $layout == 'layout_one' ) { ?>

have_posts() ) : $post_query->the_post(); if( has_post_thumbnail() ) : ?>

have_posts() ) : $post_query->the_post(); if( has_post_thumbnail() ) : ?>
'', 'post_no' => 4, 'layout' => 'layout_one', 'post_type' => 'recent_post', 'post_content' => 'display_time', ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>