'pragyan_tabbed_widget', 'description' => __('A widget shows recent posts and comment in tabbed layout.', 'pragyan') ); parent::__construct('pragyan_tabbed_widget', __('Pragyan::Tabbed', 'pragyan'), $widget_ops); } public function widget_fields() { $fields = array( 'latest_post_tab_title' => array( 'name' => 'latest_post_tab_title', 'title' => esc_html__('Posts', 'pragyan'), 'type' => 'text', 'default' => esc_html__('Latest Posts', 'pragyan'), ), 'latest_post_count' => array( 'name' => 'latest_post_count', 'title' => esc_html__('Number of Posts', 'pragyan'), 'type' => 'number', 'default' => 3, ), 'recent_comment_tab_title' => array( 'name' => 'recent_comment_tab_title', 'title' => esc_html__('Comments', 'pragyan'), 'type' => 'text', 'default' => esc_html__('Comments', 'pragyan'), ), ); return $fields; } function widget($args, $instance_arg) { $instance = Pragyan_Widget_Validation::instance()->validate($instance_arg, $this->widget_fields()); echo $args['before_widget']; ?>
$pragyan_post_count ); $latest_query = new WP_Query($latest_args); if ($latest_query->have_posts()) { while ($latest_query->have_posts()) { $latest_query->the_post(); ?>
    $pragyan_comments_count)); foreach ($pragyan_tabbed_comments as $comment) { ?>
  • comment_post_ID); echo '
    ' . get_avatar($comment, '55') . '
    '; ?>
    comment_author); ?> : comment_content, 50); ?>