'itx_tabbed_sidebar',
'description' => __('Sidebar containing tabs that displays posts, categories, pages, comments, tags, etc.', 'itx'),
);
$this->WP_Widget('itx_tabbed_sidebar', __('Tabbed Sidebar', 'itx'), $widget_args);
$this->option = array(
0=>__('None','itx'),
'categories'=>__('Categories','itx'),
'posts'=>__('Recent Posts','itx'),
'comments'=>__('Recent Comments','itx'),
'archives'=>__('Monthly Archives','itx'),
'meta'=>__('Meta','itx'),
'calendar'=>__('Calendar','itx'),
'blogroll'=>__('Blogroll','itx'),
'tags'=>__('Tag Cloud','itx'),
'pages'=>__('Pages','itx'),
"text"=>__('Custom Text','itx'),
);
$this->title = array(
0=>__('None','itx'),
'categories'=>__('Categories','itx'),
'posts'=>__('Posts','itx'),
'comments'=>__('Comments','itx'),
'archives'=>__('Archives','itx'),
'meta'=>__('Meta','itx'),
'calendar'=>__('Calendar','itx'),
'blogroll'=>__('Blogroll','itx'),
'tags'=>__('Tags','itx'),
'pages'=>__('Pages','itx'),
);
}
function widget($args, $instance){
extract($args);
echo $before_widget.'
';
for ($i=0;$i
';
if ($type=='categories'){
echo'';
wp_list_categories('show_count=1&title_li=&use_desc_for_title=1');
echo ' ';
}elseif ($type=='posts'){
echo '';
wp_get_archives('type=postbypost&limit=10');
echo ' ';
}elseif ($type=='comments'){
global $wpdb, $comments, $comment;
if ( !$comments = wp_cache_get( 'recent_comments' ) ) {
$comments = $wpdb->get_results("SELECT $wpdb->comments.* FROM $wpdb->comments JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID WHERE comment_approved = '1' AND post_status = 'publish' ORDER BY comment_date_gmt DESC LIMIT 15");
wp_cache_add( 'recent_comments', $comments);
}
add_filter( 'get_comment_excerpt', 'convert_smilies',20 );
echo '';
if ( $comments ) : foreach ( (array) $comments as $comment) :
echo '';
endforeach; endif;
echo ' ';
}elseif ($type=='archives'){
echo '';
wp_get_archives('type=monthly&show_post_count=1');
echo ' ';
}elseif ($type=='meta'){
echo '';
wp_register();?>
RSS'); ?>
RSS'); ?>
WordPress.org
';
}elseif ($type=='calendar'){
echo '';
get_calendar();
echo '
';
}elseif ($type=='blogroll'){
echo'';
wp_list_bookmarks('title_li=&categorize=0');
echo' ';
}elseif ($type=='tags'){
echo '';
wp_tag_cloud();
echo "
";
}elseif ($type=='pages'){
echo'';
wp_list_pages('title_li=');
echo' ';
}elseif ($type=='text'){
echo '';
echo $instance['textcontent'][$i];
echo '
';
}
echo' ';
}
echo''.$after_widget;
}
function form($instance){
$tabbed=$texthead=$textcontent=0;
extract($instance);
?>
get_field_id('t').$i.'"
name="'.$this->get_field_name('tabbed')."[$i]".'">'.$this->tab_opts($tabbed[$i]).'
'.__('Title','itx').' :
'.__('Content','itx').' :
';
}?>
You may oveflow the head section of the tab if you display all of them. Choose wisely
option as $id => $val ) {
$ret.= ''.$val.' ';
}
return $ret;
}
}
/****/
// Register Widgets
register_widget('itx_tabbed_sidebar');
?>