Fix current-cat & current-cat-parent classes for Category listings for non-category taxonomies. General cleanup of wp_list_categories() sanity checking. Props TheDeadMedic for the initial taxonomy patch. Fixes #15143

git-svn-id: http://svn.automattic.com/wordpress/trunk@15847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-10-19 10:10:11 +00:00
parent b3334f02af
commit 0c56811154
1 changed files with 16 additions and 15 deletions

View File

@ -1556,7 +1556,7 @@ class Walker_Category extends Walker {
$link .= '>';
$link .= $cat_name . '</a>';
if ( (! empty($feed_image)) || (! empty($feed)) ) {
if ( !empty($feed_image) || !empty($feed) ) {
$link .= ' ';
if ( empty($feed_image) )
@ -1564,9 +1564,9 @@ class Walker_Category extends Walker {
$link .= '<a href="' . get_term_feed_link( $category->term_id, $category->taxonomy, $feed_type ) . '"';
if ( empty($feed) )
if ( empty($feed) ) {
$alt = ' alt="' . sprintf(__( 'Feed for all posts filed under %s' ), $cat_name ) . '"';
else {
} else {
$title = ' title="' . $feed . '"';
$alt = ' alt="' . $feed . '"';
$name = $feed;
@ -1579,29 +1579,30 @@ class Walker_Category extends Walker {
$link .= $name;
else
$link .= "<img src='$feed_image'$alt$title" . ' />';
$link .= '</a>';
if ( empty($feed_image) )
$link .= ')';
}
if ( isset($show_count) && $show_count )
if ( !empty($show_count) )
$link .= ' (' . intval($category->count) . ')';
if ( isset($show_date) && $show_date ) {
if ( !empty($show_date) )
$link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp);
}
if ( isset($current_category) && $current_category )
$_current_category = get_category( $current_category );
if ( 'list' == $args['style'] ) {
$output .= "\t<li";
$class = 'cat-item cat-item-'.$category->term_id;
if ( isset($current_category) && $current_category && ($category->term_id == $current_category) )
$class .= ' current-cat';
elseif ( isset($_current_category) && $_current_category && ($category->term_id == $_current_category->parent) )
$class .= ' current-cat-parent';
$output .= ' class="'.$class.'"';
$class = 'cat-item cat-item-' . $category->term_id;
if ( !empty($current_category) ) {
$_current_category = get_term( $current_category, $category->taxonomy );
if ( $category->term_id == $current_category )
$class .= ' current-cat';
elseif ( $category->term_id == $_current_category->parent )
$class .= ' current-cat-parent';
}
$output .= ' class="' . $class . '"';
$output .= ">$link\n";
} else {
$output .= "\t$link<br />\n";