__( 'Displays most Popular Posts with Thumbnail.','arbitragex' ) ) ); } public function form( $instance ) { $defaults = array( 'title_length' => 7, 'comment_num' => 1, 'date' => 1, 'days' => 30, 'show_thumb3' => 1, 'box_layout' => 'horizontal-small', 'show_excerpt' => 0, 'excerpt_length' => 10, ); $instance = wp_parse_args((array) $instance, $defaults); $title = isset( $instance[ 'title' ] ) ? $instance[ 'title' ] : __( 'Popular Posts','arbitragex' ); $title_length = isset( $instance[ 'title_length' ] ) ? intval( $instance[ 'title_length' ] ) : 7; $qty = isset( $instance[ 'qty' ] ) ? intval( $instance[ 'qty' ] ) : 5; $comment_num = isset( $instance[ 'comment_num' ] ) ? intval( $instance[ 'comment_num' ] ) : 1; $date = isset( $instance[ 'date' ] ) ? intval( $instance[ 'date' ] ) : 1; $days = isset( $instance[ 'days' ] ) ? intval( $instance[ 'days' ] ) : 30; $show_thumb3 = isset( $instance[ 'show_thumb3' ] ) ? intval( $instance[ 'show_thumb3' ] ) : 1; $box_layout = $instance['box_layout']; $show_excerpt = isset( $instance[ 'show_excerpt' ] ) ? esc_attr( $instance[ 'show_excerpt' ] ) : 1; $excerpt_length = isset( $instance[ 'excerpt_length' ] ) ? intval( $instance[ 'excerpt_length' ] ) : 10; ?>

'; $close_li_item = '
'; } else { $thumbnail = 'widgetfull'; $open_li_item = '
  • '; $close_li_item = '
  • '; } global $post; $popular_days = array(); if ( $days ) { $popular_days = array( //set date ranges 'after' => "$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 '