widget_cssclass = 'widget_ajima_tab_posts'; $this->widget_description = __("Displays Tab Widget", 'ajima'); $this->widget_id = 'ajima_tab_posts'; $this->widget_name = __('Ajima: Tab Posts', 'ajima'); $this->settings = array( 'popular_heading' => array( 'label' => esc_html__('Popular', 'ajima'), 'type' => 'heading', ), 'popular_number' => array( 'label' => esc_html__('No. of Posts:', 'ajima'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'recent_heading' => array( 'label' => esc_html__('Recent', 'ajima'), 'type' => 'heading', ), 'recent_number' => array( 'label' => esc_html__('No. of Posts:', 'ajima'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'comments_heading' => array( 'label' => esc_html__('Comments', 'ajima'), 'type' => 'heading', ), 'comments_number' => array( 'label' => esc_html__('No. of Comments:', 'ajima'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'tagged_heading' => array( 'label' => esc_html__('Tagged', 'ajima'), 'type' => 'heading', ), 'select_image_size' => array( 'label' => esc_html__('Select Image Size Featured Post:', 'ajima'), 'type' => 'select', 'default' => 'medium', 'options' => array( 'thumbnail' => esc_html__('Thumbnail', 'ajima'), 'medium' => esc_html__('Medium', 'ajima'), 'large' => esc_html__('Large', 'ajima'), 'full' => esc_html__('Full', 'ajima'), ), ), 'style' => array( 'type' => 'select', 'label' => __('Style', 'ajima'), 'options' => array( 'style_1' => __('Style 1', 'ajima'), 'style_2' => __('Style 2', 'ajima'), ), 'std' => 'style_1', ), 'show_date' => array( 'type' => 'checkbox', 'label' => __('Show Date', 'ajima'), 'std' => true, ), 'date_format' => array( 'type' => 'select', 'label' => __('Date Format', 'ajima'), 'options' => array( 'format_1' => __('Format 1', 'ajima'), 'format_2' => __('Format 2', 'ajima'), ), 'std' => 'format_1', ), ); parent::__construct(); } /** * 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) { echo $args['before_widget']; ?>
render_news('recent', $instance); ?>
render_comments($instance); ?>
render_tagged($instance); ?>
$instance['popular_number'], 'no_found_rows' => true, 'orderby' => 'comment_count', 'category_name' => $cat_slug, ); break; case 'recent': $cat_slug = ''; if (isset($instance['tab_cat'])) { $cat_slug = $instance['tab_cat']; } $qargs = array( 'posts_per_page' => $instance['recent_number'], 'no_found_rows' => true, 'category_name' => $cat_slug, ); break; default: break; } $tab_posts_query = new WP_Query($qargs); $style = $instance['style']; if ($tab_posts_query->have_posts()): ?>
have_posts()): $tab_posts_query->the_post(); ?>
>
', '' ); ?>
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' => $instance['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; } }