'allinone_widget_tabbed', 'description' => esc_html__('Tabbed widget.', 'allinone'), ); $fields = array( 'popular_heading' => array( 'label' => esc_html__('Popular', 'allinone'), 'type' => 'heading', ), 'popular_number' => array( 'label' => esc_html__('No. of Posts:', 'allinone'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'select_image_size' => array( 'label' => esc_html__('Select Image Size Featured Post:', 'allinone'), 'type' => 'select', 'default' => 'medium', 'options' => array( 'thumbnail' => esc_html__('Thumbnail', 'allinone'), 'medium' => esc_html__('Medium', 'allinone'), 'large' => esc_html__('Large', 'allinone'), 'full' => esc_html__('Full', 'allinone'), ), ), 'excerpt_length' => array( 'label' => esc_html__('Excerpt Length:', 'allinone'), 'description' => esc_html__('Number of words', 'allinone'), 'default' => 10, 'css' => 'max-width:60px;', 'min' => 0, 'max' => 200, ), 'recent_heading' => array( 'label' => esc_html__('Recent', 'allinone'), 'type' => 'heading', ), 'recent_number' => array( 'label' => esc_html__('No. of Posts:', 'allinone'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'comments_heading' => array( 'label' => esc_html__('Comments', 'allinone'), 'type' => 'heading', ), 'comments_number' => array( 'label' => esc_html__('No. of Comments:', 'allinone'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'tagged_heading' => array( 'label' => esc_html__('Tagged', 'allinone'), 'type' => 'heading', ), ); parent::__construct('allinone-tabbed', esc_html__('Allinone: Sidebar Tab Widget', 'allinone'), $opts, array(), $fields); } /** * Outputs the content for the current widget instance. * * @param array $args Display arguments. * @param array $instance Settings for the current widget instance. * @since 1.0.0 * */ 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', 'category_name' => $cat_slug, ); break; case 'recent': $cat_slug = ''; if (isset($params['tab_cat'])) { $cat_slug = $params['tab_cat']; } $qargs = array( 'posts_per_page' => $params['recent_number'], 'no_found_rows' => true, 'category_name' => $cat_slug, ); break; default: break; } $tab_posts_query = new WP_Query($qargs); if ($tab_posts_query->have_posts()): ?> 10, 'no_found_rows' => true, 'category_name' => $cat_slug, ); $tab_posts_query = new WP_Query($qargs); if ($tab_posts_query->have_posts()) { while ($tab_posts_query->have_posts()) { $tab_posts_query->the_post(); $post_array[] = get_the_ID(); } wp_reset_postdata(); } } $comment_args = array( 'number' => $params['comments_number'], 'status' => 'approve', 'post_status' => 'publish', 'post__in' => $post_array, ); $comments = get_comments($comment_args); ?> 10, 'largest' => 22, 'unit' => 'px', 'format' => 'flat', 'separator' => " ", 'orderby' => 'count', 'order' => 'DESC', 'show_count' => 1, 'echo' => false ); $tag_string = wp_generate_tag_cloud($tags, $args); echo $tag_string; } } endif;