function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['posts_list_title']); $no_of_posts = $instance['no_of_posts']; $posts_order = $instance['posts_order']; $thumb = $instance['thumb']; echo $before_widget; echo $before_title; echo $title; ?> <?php echo $after_title; ?> <ul> <?php if ($posts_order == 'popular') { tie_popular_posts($no_of_posts, $thumb); } elseif ($posts_order == 'random') { tie_random_posts($no_of_posts, $thumb); } elseif ($posts_order == 'viewed') { tie_most_viewed_posts($no_of_posts, $thumb); } elseif ($posts_order == 'best') { tie_best_reviews_posts($no_of_posts, $thumb); } else { tie_last_posts($no_of_posts, $thumb); } ?> </ul> <div class="clear"></div> <?php echo $after_widget; }
function widget($args, $instance) { extract($args); $posts_order = $instance['posts_order']; if (empty($instance['posts_number']) || $instance['posts_number'] == ' ' || !is_numeric($instance['posts_number'])) { $posts_number = 5; } else { $posts_number = $instance['posts_number']; } ?> <div class="widget" id="tabbed-widget"> <div class="widget-container"> <div class="widget-top"> <ul class="tabs posts-taps"> <li class="tabs"><a href="#tab1"><?php _e('Popular', 'tie'); ?> </a></li> <li class="tabs"><a href="#tab2"><?php _e('Recent', 'tie'); ?> </a></li> <li class="tabs" style="margin-left:0; "><a href="#tab3"><?php _e('Comments', 'tie'); ?> </a></li> </ul> </div> <div id="tab1" class="tabs-wrap"> <ul> <?php if ($posts_order == 'viewed') { tie_most_viewed_posts($posts_number); } else { tie_popular_posts($posts_number); } ?> </ul> </div> <div id="tab2" class="tabs-wrap"> <ul> <?php tie_last_posts($posts_number); ?> </ul> </div> <div id="tab3" class="tabs-wrap"> <ul> <?php tie_most_commented($posts_number); ?> </ul> </div> </div> </div><!-- .widget /--> <?php }