'primebulletin_widget_tabbed', 'description' => esc_html__('Tabbed widget.', 'primebulletin'), ); $fields = array( 'popular_heading' => array( 'label' => esc_html__('Popular', 'primebulletin'), 'type' => 'heading', ), 'popular_title' => array( 'label' => esc_html__('Popular Tab Title', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Popular', 'primebulletin'), ), 'popular_number' => array( 'label' => esc_html__('No. of Posts:', 'primebulletin'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'enable_description' => array( 'label' => esc_html__('Enable Description:', 'primebulletin'), 'type' => 'checkbox', 'default' => false, ), 'excerpt_length' => array( 'label' => esc_html__('Excerpt Length:', 'primebulletin'), 'description' => esc_html__('Number of words', 'primebulletin'), 'default' => 10, 'css' => 'max-width:60px;', 'min' => 0, 'max' => 200, ), 'recent_heading' => array( 'label' => esc_html__('Recent', 'primebulletin'), 'type' => 'heading', ), 'recent_title' => array( 'label' => esc_html__('Recent Tab Title', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Recent', 'primebulletin'), ), 'recent_number' => array( 'label' => esc_html__('No. of Posts:', 'primebulletin'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), 'comments_heading' => array( 'label' => esc_html__('Comments', 'primebulletin'), 'type' => 'heading', ), 'comment_title' => array( 'label' => esc_html__('Comment Tab Title', 'primebulletin'), 'type' => 'text', 'class' => 'widefat', 'default' => esc_html__('Comments', 'primebulletin'), ), 'comments_number' => array( 'label' => esc_html__('No. of Comments:', 'primebulletin'), 'type' => 'number', 'css' => 'max-width:60px;', 'default' => 5, 'min' => 1, 'max' => 10, ), ); parent::__construct( 'primebulletin-tabbed', esc_html__( 'PrimeBulletin: Sidebar Tab Widget', 'primebulletin' ), $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; $popular_title = isset( $params['popular_title'] ) ? $params['popular_title'] : ''; $recent_title = isset( $params['recent_title'] ) ? $params['recent_title'] : ''; $comment_title = isset( $params['comment_title'] ) ? $params['comment_title'] : ''; echo $args['before_widget']; ?>
render_news('recent', $params );?>
render_comments( $params );?>
$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 ); if ( !empty( $comments ) ):?>