FUNZIONA";
}
function my_list_categories($args = '') {
$defaults = array(
'show_option_all' => '', 'orderby' => 'name',
'order' => 'ASC', 'show_last_update' => 0,
'style' => 'list', 'show_count' => 0,
'hide_empty' => 1, 'use_desc_for_title' => 1,
'child_of' => 0, 'feed' => '', 'feed_type' => '',
'feed_image' => '', 'exclude' => '', 'current_category' => 0,
'hierarchical' => true, 'title_li' => __('Categories'),
'echo' => 1, 'depth' => 0
);
$r = wp_parse_args( $args, $defaults );
if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
$r['pad_counts'] = true;
}
if ( isset( $r['show_date'] ) ) {
$r['include_last_update_time'] = $r['show_date'];
}
extract( $r );
$categories = get_categories($r);
$output = '';
if ( $title_li && 'list' == $style ) {
$output = '
[+] ' . $r['title_li'] . '
';
$output .= '';
}
if ( empty($categories) ) {
if ( 'list' == $style )
$output .= '- ' . __("No categories") . '
';
else
$output .= __("No categories");
} else {
global $wp_query;
if( !empty($show_option_all) )
if ('list' == $style )
$output .= '- ' . $show_option_all . '
';
else
$output .= '' . $show_option_all . '';
if ( empty( $r['current_category'] ) && is_category() )
$r['current_category'] = $wp_query->get_queried_object_id();
if ( $hierarchical )
$depth = $r['depth'];
else
$depth = -1; // Flat.
$output .= walk_category_tree($categories, $depth, $r);
}
if ( $title_li && 'list' == $style )
$output .= '
';
$output = apply_filters('wp_list_categories', $output);
if ( $echo )
echo $output;
else
return $output;
}
function my_get_archives($args = '') {
$output = '';
$output .= '';
$output .= '[+] Archives
';
$output .= '';
echo($output);
wp_get_archives('type=yearly');
$output = '
';
echo($output);
}
function my_list_bookmarks($args = '') {
$defaults = array(
'orderby' => 'name', 'order' => 'ASC',
'limit' => -1, 'category' => '', 'exclude_category' => '',
'category_name' => '', 'hide_invisible' => 1,
'show_updated' => 0, 'echo' => 1,
'categorize' => 1, 'title_li' => __('Bookmarks'),
'title_before' => '', 'title_after' => '
',
'category_orderby' => 'name', 'category_order' => 'ASC',
'class' => 'linkcat', 'category_before' => '',
'category_after' => ''
);
$dropdown = '[+] ';
$div_before = '';
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
$output = '';
if ( $categorize ) {
//Split the bookmarks into ul's for each category
$cats = get_terms('link_category', array('name__like' => $category_name, 'include' => $category, 'exclude' => $exclude_category, 'orderby' => $category_orderby, 'order' => $category_order, 'hierarchical' => 0));
$count = 0;
foreach ( (array) $cats as $cat ) {
$params = array_merge($r, array('category'=>$cat->term_id));
$bookmarks = get_bookmarks($params);
if ( empty($bookmarks) )
continue;
$output .= str_replace(array('%id', '%class'), array("linkcat-$cat->term_id", $class), $category_before);
$catname = apply_filters( "link_category", $cat->name );
$output .= "$title_before".str_replace('%id', $count, $dropdown)."$catname$title_after\n\t".str_replace('%id', $count, $div_before)."\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t$div_after
\n$category_after\n";
$count++;
}
} else {
//output one single list using title_li for the title
$bookmarks = get_bookmarks($r);
if ( !empty($bookmarks) ) {
if ( !empty( $title_li ) ){
$output .= str_replace(array('%id', '%class'), array("linkcat-$category", $class), $category_before);
$output .= "$title_before$title_li$title_after\n\t\n";
$output .= _walk_bookmarks($bookmarks, $r);
$output .= "\n\t
\n$category_after\n";
} else {
$output .= _walk_bookmarks($bookmarks, $r);
}
}
}
$output = apply_filters( 'wp_list_bookmarks', $output );
if ( !$echo )
return $output;
echo $output;
}
?>