__( 'Displays most Popular Posts with Thumbnail.','realistic' ) ) ); } public function form( $instance ) { $defaults = array( 'comments' => 1, 'date' => 1, 'days' => 30, 'show_thumb' => 1, ); $instance = wp_parse_args((array) $instance, $defaults); $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Popular Posts','realistic' ); $qty = isset( $instance[ 'qty' ] ) ? intval( $instance[ 'qty' ] ) : 5; $comments = isset( $instance[ 'comments' ] ) ? intval( $instance[ 'comments' ] ) : 1; $date = isset( $instance[ 'date' ] ) ? intval( $instance[ 'date' ] ) : 1; $days = isset( $instance[ 'days' ] ) ? intval( $instance[ 'days' ] ) : 0; $show_thumb = isset( $instance[ 'show_thumb' ] ) ? intval( $instance[ 'show_thumb' ] ) : 1; ?>

"$days day ago", 'before' => 'today', //allow exact matches to be returned 'inclusive' => true, ); } $popular = get_posts( array( 'suppress_filters' => false, 'ignore_sticky_posts' => 1, 'orderby' => 'comment_count', 'numberposts' => $qty, 'date_query' => $popular_days) ); echo '
'."\r\n"; } } add_action( 'widgets_init', create_function( '', 'register_widget( "realistic_popular_posts_widget" );' ) );