function widget($args, $instance) { extract($args); $rating = array(); $numb = apply_filters('widget_title', empty($instance['title']) ? __('Search', 'tfuse') : $instance['title'], $instance, $this->id_base); ?> <?php $recent_posts = tfuse_shortcode_posts_tabs(array('sort' => 'recent', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $popular_posts = tfuse_shortcode_posts_tabs(array('sort' => 'popular', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $commented_posts = tfuse_shortcode_posts_tabs(array('sort' => 'commented', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $return_html = ''; $return_html .= '<div class="widget widget_tabs"> <ul class="nav nav-tabs nav-justified clearfix active_bookmark1"> <li class="active"><a href="#tab_cont_1_1" data-toggle="tab">' . __('Popular', 'tfuse') . '</a></li> <li><a href="#tab_cont_1_2" data-toggle="tab">' . __('Latest', 'tfuse') . '</a></li> <li><a href="#tab_cont_1_3" data-toggle="tab">' . __('Comments', 'tfuse') . '</a></li> </ul><div class="tab-content clearfix">'; $return_html .= '<div id="tab_cont_1_1" class="tab-pane fade in active"> <ul class="side-postlist">'; $k = 0; foreach ($popular_posts as $post_val) { if ($k == $numb) { break; } $return_html .= '<li>'; if (!empty($post_val['post_img'])) { $return_html .= ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; } $return_html .= '<span class="date">' . $post_val['post_date_post'] . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $k++; } $return_html .= '</ul> </div> <div id="tab_cont_1_2" class="tab-pane fade"> <ul class="side-postlist">'; $c = 0; foreach ($recent_posts as $post_val) { if ($c == $numb) { break; } $return_html .= '<li>'; if (!empty($post_val['post_img'])) { $return_html .= ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; } $return_html .= '<span class="date">' . $post_val['post_date_post'] . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $c++; } $return_html .= '</ul> </div>'; $return_html .= '<div id="tab_cont_1_3" class="tab-pane fade"> <ul class="side-postlist">'; $z = 0; foreach ($commented_posts as $post_val) { if ($z == $numb) { break; } $return_html .= '<li>'; if (!empty($post_val['post_img'])) { $return_html .= ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; } $return_html .= '<span class="date">' . get_the_date($post_val['post_date_post']) . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $z++; } $return_html .= '</ul> </div> </div> </div>'; echo $return_html; ?> <!-- widget sidebar tabs --> <?php }
function tfuse_tabs_posts($atts) { extract(shortcode_atts(array('num' => ''), $atts)); $recent_posts = tfuse_shortcode_posts_tabs(array('sort' => 'recent', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $popular_posts = tfuse_shortcode_posts_tabs(array('sort' => 'popular', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $commented_posts = tfuse_shortcode_posts_tabs(array('sort' => 'commented', 'items' => 5, 'image_post' => true, 'image_width' => 80, 'image_height' => 80, 'image_class' => '')); $return_html = ''; $return_html .= '<div class="widget widget_tabs"> <ul class="nav nav-tabs nav-justified clearfix active_bookmark1"> <li class="active"><a href="#tab_cont_1_1" data-toggle="tab">' . __('Popular', 'tfuse') . '</a></li> <li><a href="#tab_cont_1_2" data-toggle="tab">' . __('Latest', 'tfuse') . '</a></li> <li><a href="#tab_cont_1_3" data-toggle="tab">' . __('Recent comments', 'tfuse') . '</a></li> </ul><div class="tab-content clearfix">'; $return_html .= '<div id="tab_cont_1_1" class="tab-pane fade in active"> <ul class="side-postlist">'; $k = 0; foreach ($popular_posts as $post_val) { if ($k == $num) { break; } $return_html .= '<li>'; $return_html .= ' ' . ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; $return_html .= '<span class="date">' . $post_val['post_date_post'] . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $k++; } $return_html .= '</ul> </div> <div id="tab_cont_1_2" class="tab-pane fade"> <ul class="side-postlist">'; $c = 0; foreach ($recent_posts as $post_val) { if ($c == $num) { break; } $return_html .= '<li>'; $return_html .= ' ' . ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; $return_html .= '<span class="date">' . $post_val['post_date_post'] . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $c++; } $return_html .= '</ul> </div>'; $return_html .= '<div id="tab_cont_1_3" class="tab-pane fade"> <ul class="side-postlist">'; $z = 0; foreach ($commented_posts as $post_val) { if ($z == $num) { break; } $return_html .= '<li>'; $return_html .= ' ' . ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; $return_html .= '<span class="date">' . $post_val['post_date_post'] . '</span> <h3 class="title"><a href="' . $post_val['post_link'] . '"> ' . $post_val['post_title'] . '</a></h3> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="right-arrow"><i class="icon-chevron-right"></i></a>'; $z++; } $return_html .= '</ul> </div> </div> </div>'; return $return_html; }
function tfuse_tabs_posts($atts) { extract(shortcode_atts(array('num' => ''), $atts)); $recent_posts = tfuse_shortcode_posts_tabs(array('sort' => 'recent', 'items' => 5, 'image_post' => true, 'image_width' => 62, 'image_height' => 62, 'image_class' => 'thumb')); $popular_posts = tfuse_shortcode_posts_tabs(array('sort' => 'popular', 'items' => 5, 'image_post' => true, 'image_width' => 62, 'image_height' => 62, 'image_class' => 'thumb')); $return_html = ''; $return_html .= '<div class="widget widget_tabs"> <ul class="side-tabs"> <li class="active"><a href="#tab_2_1" data-toggle="tab">' . __('Top 5', 'tfuse') . '</a></li> <li><a href="#tab_2_2" data-toggle="tab">' . __('Recent', 'tfuse') . '</a></li> </ul><div class="tab-content">'; $return_html .= '<div id="tab_2_1" class="tab-pane fade in active"> <ul class="side-postlist list-numbers">'; $k = 0; foreach ($popular_posts as $post_val) { if ($k == $num) { break; } $cat = get_the_category($post_val['post_id']); $tags = wp_get_post_tags($post_val['post_id']); $return_html .= '<li>'; $return_html .= ' ' . ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="post-title"> ' . $post_val['post_title'] . '</a> '; $return_html .= ' <span class="cat-links">' . $cat[0]->cat_name . '</span>'; if (!empty($tags)) { $return_html .= ' <span class="tag-links">'; $count = 0; foreach ($tags as $tag) { $count++; if ($count == count($tags)) { $return_html .= $tag->name; } else { $return_html .= $tag->name . ', '; } } $return_html .= '</span>'; } $k++; } $return_html .= '</ul> </div> <div id="tab_2_2" class="tab-pane fade"> <ul class="side-postlist">'; $c = 0; foreach ($recent_posts as $post_val) { if ($c == $num) { break; } $cat = get_the_category($post_val['post_id']); $tags = wp_get_post_tags($post_val['post_id']); $return_html .= '<li>'; $return_html .= ' ' . ' <a href="' . $post_val['post_link'] . '" class="post-thumbnail">' . $post_val['post_img'] . '</a> '; $return_html .= '<a href="' . $post_val['post_link'] . '" class="post-title"> ' . $post_val['post_title'] . '</a> '; $return_html .= ' <span class="cat-links">' . $cat[0]->cat_name . '</span>'; if (!empty($tags)) { $return_html .= ' <span class="tag-links">'; $count = 0; foreach ($tags as $tag) { $count++; if ($count == count($tags)) { $return_html .= $tag->name; } else { $return_html .= $tag->name . ', '; } } $return_html .= '</span>'; } $return_html .= '</li>'; $c++; } $return_html .= '</ul> </div> </div> </div>'; return $return_html; }