'tab_widget', 'description' => esc_html__('Tab widget: Popular, latest and comment.', 'nanopress') ); parent::__construct('nanopress_Tab_Posts_Widget', esc_html__('jellywp: Tab widget', 'nanopress'), $widget_ops); } /*-----------------------------------------------------------------------------------*/ /* Display Widget /*-----------------------------------------------------------------------------------*/ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); if (!$number = absint($instance['number'])) $number = 5; $jellywp_args = array( 'showposts' => $number, 'orderby' => 'comment_count', 'ignore_sticky_posts' => 1 ); $show_comment_tab = isset($instance['show_comment_tab']) ? $instance['show_comment_tab'] : false; $jellywp_args1 = array( 'showposts' => $number, 'orderby' => 'date', 'ignore_sticky_posts' => 1 ); $jellywp_widget = null; $jellywp_widget = new WP_Query($jellywp_args); $jellywp_widget1 = null; $jellywp_widget1 = new WP_Query($jellywp_args1); print $before_widget; if ($title != "") { print $before_title; print esc_attr($title); print $after_title; } ?>
    have_posts()) { $jellywp_widget->the_post(); $post_id = get_the_ID(); ?>
  • ';} ?>

    have_posts()) { $jellywp_widget1->the_post(); $post_id = get_the_ID(); ?>
  • ';} ?>

    'approve', 'number' => $number ); $postcount=0; $comments = get_comments($args); foreach($comments as $comment) : $postcount++; $commentcontent = strip_tags($comment->comment_content); if (strlen($commentcontent)> 50) { $commentcontent = mb_substr($commentcontent, 0, 49) . "..."; } $commentauthor = $comment->comment_author; if (strlen($commentauthor)> 30) { $commentauthor = mb_substr($commentauthor, 0, 29) . "..."; } $commentid = $comment->comment_ID; $commenturl = get_comment_link($commentid); ?>
'on' ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>

id="get_field_id('show_comment_tab')); ?>" name="get_field_name('show_comment_tab')); ?>" />