'blog_prime_widget_tabbed', 'description' => esc_html__('Tabbed widget.', 'blog-prime'), ); $fields = array( 'popular_heading' => array( 'label' => esc_html__('Popular', 'blog-prime'), 'type' => 'heading', ), 'popular_number' => array( 'label' => esc_html__('No. of Posts:', 'blog-prime'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'enable_discription' => array( 'label' => esc_html__('Enable Description:', 'blog-prime'), 'type' => 'checkbox', 'default' => true, ), 'select_image_size' => array( 'label' => esc_html__('Select Image Size Featured Post:', 'blog-prime'), 'type' => 'select', 'default' => 'medium', 'options' => array( 'thumbnail' => esc_html__('Thumbnail', 'blog-prime'), 'medium' => esc_html__( 'Medium', 'blog-prime' ), 'large' => esc_html__( 'Large', 'blog-prime' ), 'full' => esc_html__( 'Full', 'blog-prime' ), ), ), 'excerpt_length' => array( 'label' => esc_html__('Excerpt Length:', 'blog-prime'), 'description' => esc_html__('Number of words', 'blog-prime'), 'default' => 10, 'css' => 'max-width:60px;', 'min' => 0, 'max' => 200, ), 'recent_heading' => array( 'label' => esc_html__('Recent', 'blog-prime'), 'type' => 'heading', ), 'recent_number' => array( 'label' => esc_html__('No. of Posts:', 'blog-prime'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'comments_heading' => array( 'label' => esc_html__('Comments', 'blog-prime'), 'type' => 'heading', ), 'comments_number' => array( 'label' => esc_html__('No. of Comments:', 'blog-prime'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), ); parent::__construct( 'blog-prime-tabbed', esc_html__( 'BP: Tab Posts Widget', 'blog-prime' ), $opts, array(), $fields ); } /** * Outputs the content for the current widget instance. * * @since 1.0.0 * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. */ function widget( $args, $instance ) { $params = $this->get_params( $instance ); $tab_id = 'tabbed-'.$this->number; echo $args['before_widget']; ?>
$params['popular_number'], 'no_found_rows' => true, 'orderby' => 'comment_count', ); break; case 'recent': $qargs = array( 'posts_per_page' => $params['recent_number'], 'no_found_rows' => true, ); break; default: break; } $tab_posts_query = new WP_Query( $qargs ); if ( $tab_posts_query->have_posts() ): ?> $params['comments_number'], 'status' => 'approve', 'post_status' => 'publish', ); $comments = get_comments( $comment_args ); ?>