__( 'Show Your Recent Post On your Widget Area.', 'is-realestate' ), ) // Args ); } public function widget( $args, $instance ) { $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; $post_num = ! empty( $instance['post_num'] ) ? $instance['post_num'] : ''; if($post_num=='') { $post_num = 3; } $realestate_title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $post_num = apply_filters( 'post_num', $post_num, $instance, $this->id_base ); // before and after widget arguments are defined by themes echo wp_kses_post($args['before_widget']); if ( ! empty( $realestate_title ) ) echo wp_kses_post($args['before_title']) . wp_kses_post($realestate_title) . wp_kses_post($args['after_title']); $recent_args= array('post_type'=>'post', 'post__not_in' => get_option( 'sticky_posts' ), 'posts_per_page'=>$post_num); $recent_post = new WP_Query($recent_args); if($recent_post->have_posts()){ while($recent_post->have_posts()){ $recent_post->the_post(); ?>
'blog-thumb img-responsive '); the_post_thumbnail('thumbnail', $thumb_data); ?>


'', 'post_num' => '', 'text' => '', 'filter' => false, // For back-compat. 'visual' => null, // Must be explicitly defined. ) ); $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['post_num'] = sanitize_text_field( $new_instance['post_num'] ); if ( current_user_can( 'unfiltered_html' ) ) { $instance['text'] = $new_instance['text']; } else { $instance['text'] = wp_kses_post( $new_instance['text'] ); } $instance['filter'] = ! empty( $new_instance['filter'] ); // Upgrade 4.8.0 format. if ( isset( $old_instance['filter'] ) && 'content' === $old_instance['filter'] ) { $instance['visual'] = true; } if ( 'content' === $new_instance['filter'] ) { $instance['visual'] = true; } if ( isset( $new_instance['visual'] ) ) { $instance['visual'] = ! empty( $new_instance['visual'] ); } // Filter is always true in visual mode. if ( ! empty( $instance['visual'] ) ) { $instance['filter'] = true; } return $instance; } } ?>