Use wp_list_categories() in templates.
git-svn-id: http://svn.automattic.com/wordpress/trunk@3881 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f34731ff30
commit
49e390d402
|
@ -3,13 +3,9 @@
|
||||||
<div id="menu">
|
<div id="menu">
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<?php wp_list_pages(); ?>
|
<?php wp_list_pages('title_li=' . __('Pages:')); ?>
|
||||||
<?php wp_list_bookmarks(); ?>
|
<?php wp_list_bookmarks('title_after=&title_before='); ?>
|
||||||
<li id="categories"><?php _e('Categories:'); ?>
|
<?php wp_list_categories('title_li=' . __('Categories:')); ?>
|
||||||
<ul>
|
|
||||||
<?php wp_list_cats(); ?>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li id="search">
|
<li id="search">
|
||||||
<label for="s"><?php _e('Search:'); ?></label>
|
<label for="s"><?php _e('Search:'); ?></label>
|
||||||
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
|
||||||
|
|
|
@ -46,11 +46,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li><h2>Categories</h2>
|
<?php wp_list_categories('sort_column=name&optioncount=1&hierarchical=0&title_li=<h2>Categories</h2>'); ?>
|
||||||
<ul>
|
|
||||||
<?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0'); ?>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
|
<?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
|
||||||
<?php wp_list_bookmarks(); ?>
|
<?php wp_list_bookmarks(); ?>
|
||||||
|
|
|
@ -212,11 +212,11 @@ function wp_list_categories($args = '') {
|
||||||
else
|
else
|
||||||
parse_str($args, $r);
|
parse_str($args, $r);
|
||||||
|
|
||||||
$defaults = array('show_option_all' => '', 'orderby' => 'ID',
|
$defaults = array('show_option_all' => '', 'orderby' => 'name',
|
||||||
'order' => 'asc', 'style' => 'list', 'show_last_update' => 0,
|
'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list',
|
||||||
'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
|
'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1,
|
||||||
'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '',
|
'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '',
|
||||||
'hierarchical' => true, 'title_li' => '');
|
'hierarchical' => true, 'title_li' => __('Categories'));
|
||||||
$r = array_merge($defaults, $r);
|
$r = array_merge($defaults, $r);
|
||||||
$r['include_last_update_time'] = $r['show_date'];
|
$r['include_last_update_time'] = $r['show_date'];
|
||||||
extract($r);
|
extract($r);
|
||||||
|
@ -224,7 +224,7 @@ function wp_list_categories($args = '') {
|
||||||
$categories = get_categories($r);
|
$categories = get_categories($r);
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
if ( $title_li && $list )
|
if ( $title_li && 'list' == $style )
|
||||||
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
||||||
|
|
||||||
if ( empty($categories) ) {
|
if ( empty($categories) ) {
|
||||||
|
@ -243,7 +243,7 @@ function wp_list_categories($args = '') {
|
||||||
$output .= walk_category_tree($categories, $depth, $r);
|
$output .= walk_category_tree($categories, $depth, $r);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $title_li && $list )
|
if ( $title_li && 'list' == $style )
|
||||||
$output .= '</ul></li>';
|
$output .= '</ul></li>';
|
||||||
|
|
||||||
echo apply_filters('list_cats', $output);
|
echo apply_filters('list_cats', $output);
|
||||||
|
|
|
@ -430,6 +430,7 @@ function wp_list_cats($args = '') {
|
||||||
$r['show_count'] = $r['optioncount'];
|
$r['show_count'] = $r['optioncount'];
|
||||||
if ( !empty($r['list']) )
|
if ( !empty($r['list']) )
|
||||||
$r['style'] = 'break';
|
$r['style'] = 'break';
|
||||||
|
$r['title_li'] = '';
|
||||||
|
|
||||||
return wp_list_categories($r);
|
return wp_list_categories($r);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue