Add cat-item-id and page-item-id classes. Props Otto42. fixes #4703

git-svn-id: https://develop.svn.wordpress.org/trunk@5920 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2007-08-22 22:59:45 +00:00
parent 84df0a2453
commit dac74f6c47
1 changed files with 8 additions and 6 deletions

View File

@ -511,10 +511,10 @@ class Walker_Page extends Walker {
if ( $depth ) if ( $depth )
$indent = str_repeat("\t", $depth); $indent = str_repeat("\t", $depth);
extract($args, EXTR_SKIP); extract($args, EXTR_SKIP);
$css_class = 'page_item'; $css_class = 'page_item page-item-'.$page->ID;
$_current_page = get_page( $current_page ); $_current_page = get_page( $current_page );
if ( $page->ID == $current_page ) if ( $page->ID == $current_page )
$css_class .= ' current_page_item'; $css_class .= ' current_page_item ';
elseif ( $_current_page && $page->ID == $_current_page->post_parent ) elseif ( $_current_page && $page->ID == $_current_page->post_parent )
$css_class .= ' current_page_parent'; $css_class .= ' current_page_parent';
@ -634,10 +634,12 @@ class Walker_Category extends Walker {
if ( 'list' == $args['style'] ) { if ( 'list' == $args['style'] ) {
$output .= "\t<li"; $output .= "\t<li";
$class = 'cat-item cat-item-'.$category->term_id;
if ( $current_category && ($category->term_id == $current_category) ) if ( $current_category && ($category->term_id == $current_category) )
$output .= ' class="current-cat"'; $class .= ' current-cat';
elseif ( $_current_category && ($category->term_id == $_current_category->parent) ) elseif ( $_current_category && ($category->term_id == $_current_category->parent) )
$output .= ' class="current-cat-parent"'; $class .= ' current-cat-parent';
$output .= ' class="'.$class.'"';
$output .= ">$link\n"; $output .= ">$link\n";
} else { } else {
$output .= "\t$link<br />\n"; $output .= "\t$link<br />\n";
@ -692,8 +694,8 @@ class WP_Ajax_Response {
// a WP_Error object can be passed in 'id' or 'data' // a WP_Error object can be passed in 'id' or 'data'
function add( $args = '' ) { function add( $args = '' ) {
$defaults = array( $defaults = array(
'what' => 'object', 'action' => false, 'what' => 'object', 'action' => false,
'id' => '0', 'old_id' => false, 'id' => '0', 'old_id' => false,
'data' => '', 'supplemental' => array() 'data' => '', 'supplemental' => array()
); );