esc_html__( 'Display your site’s most recent Posts or a Selected Category Posts with Thumbnail.', 'bosa' ) ) ); $defaults = array( 'per_page' => 5, 'show_date_comment' => true, 'layout' => 'left' ); $this->defaults = apply_filters( 'bosa_rcs_widget_default', $defaults ); $this->fields = array( 'title' => array( 'label' => esc_html__( 'Title', 'bosa' ), 'type' => 'text' ), 'category' => array( 'label' => esc_html__( 'Select a Category', 'bosa' ), 'type' => 'dropdown-categories', ), 'per_page' => array( 'label' => esc_html__( 'Number of Posts', 'bosa' ), 'type' => 'number', 'min' => 1, 'max' => $this->defaults[ 'per_page' ], 'default' => $this->defaults[ 'per_page' ], ), 'show_date_comment' => array( 'label' => esc_html__( 'Show Date & Comments', 'bosa' ), 'type' => 'checkbox', 'default' => $this->defaults[ 'show_date_comment' ] ), 'layout' => array( 'label' => esc_html__( 'Layout', 'bosa' ), 'type' => 'radio', 'choices' => array( 'left' => esc_html__( 'Left Image', 'bosa' ), 'right' => esc_html__( 'Right Image', 'bosa' ), 'full' => esc_html__( 'Full Image', 'bosa' ) ), 'default' => $this->defaults[ 'layout' ] ) ); } public function widget( $args, $instance ){ echo $args[ 'before_widget' ]; $instance = $this->init_defaults( $instance ); $query_args = apply_filters( 'bosa_post_widget_query_args', array( 'post_type' => 'post', 'posts_per_page' => $instance[ 'per_page' ], 'cat' => $instance[ 'category' ], 'no_found_rows' => true, 'post_status' => 'publish', 'ignore_sticky_posts' => 1 ), $instance ); if( 'left' == $instance[ 'layout' ] ){ $class = 'left-thumb-widget'; }else if( 'right' == $instance[ 'layout' ] ){ $class = 'right-thumb-widget'; }else { $class = 'full-thumb-widget'; } ?>
query_it( $query_args, $instance ); ?>
have_posts() ){ while ( $query->have_posts() ){ $query->the_post(); $this->item( $instance ); } }else{ ?>

<?php echo esc_attr($alt); ?>

approved ); ?>