esc_html__( 'Support Recommended Posts with thumbnail for Widget', 'simple-days' ), ) // Args ); } public function widget( $args, $instance ) { //echo esc_html(apply_filters( 'widget_title', $instance['popular_post_title'] )); $title = !empty( $instance['title'] ) ? $instance['title'] : esc_html__('Recommended Posts', 'simple-days'); $post_in = !empty( $instance['post_in'] ) ? $instance['post_in'] : ''; $display_style = ! empty( $instance['display_style'] ) ? $instance['display_style'] : '3'; $post_in = explode(',', $post_in); $popular_args = array( 'offset' => 0, 'order' => 'DESC', 'orderby' => 'none', 'post__in' => $post_in, 'ignore_sticky_posts' => true, ); $posts = new WP_Query( $popular_args ); //var_dump($posts); if ( $posts->have_posts() ) { set_query_var( 'popular_post_style', false ); echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . esc_html($title) . $args['after_title']; } echo '
'; echo '
'; echo $args['after_widget']; } } public function form( $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; $post_in = ! empty( $instance['post_in'] ) ? $instance['post_in'] : ''; $display_style = ! empty( $instance['display_style'] ) ? $instance['display_style'] : '3'; ?>