Ticket #4703: walker-classes.diff

File walker-classes.diff, 1.4 KB (added by Otto42, 6 years ago)

Adds classes for page and category items

Line 
1Index: wp-includes/classes.php
2===================================================================
3--- wp-includes/classes.php     (revision 5852)
4+++ wp-includes/classes.php     (working copy)
5@@ -507,7 +507,7 @@
6                if ( $depth )
7                        $indent = str_repeat("\t", $depth);
8                extract($args, EXTR_SKIP);
9-               $css_class = 'page_item';
10+               $css_class = 'page_item page_item_'.$page->ID;
11                $_current_page = get_page( $current_page );
12                if ( $page->ID == $current_page )
13                        $css_class .= ' current_page_item';
14@@ -630,10 +630,12 @@
15 
16                if ( 'list' == $args['style'] ) {
17                        $output .= "\t<li";
18+                       $class = 'cat_item cat_item_'.$category->term_id;
19                        if ( $current_category && ($category->term_id == $current_category) )
20-                               $output .=  ' class="current-cat"';
21+                               $class .=  ' current-cat';
22                        elseif ( $_current_category && ($category->term_id == $_current_category->parent) )
23-                               $output .=  ' class="current-cat-parent"';
24+                               $class .=  ' current-cat-parent';
25+                       $output .=  ' class="'.$class.'"';
26                        $output .= ">$link\n";
27                } else {
28                        $output .= "\t$link<br />\n";
29@@ -688,8 +690,8 @@
30        // a WP_Error object can be passed in 'id' or 'data'
31        function add( $args = '' ) {
32                $defaults = array(
33-                       'what' => 'object', 'action' => false,
34-                       'id' => '0', 'old_id' => false,
35+                       'what' => 'object', 'action' => false,
36+                       'id' => '0', 'old_id' => false,
37                        'data' => '', 'supplemental' => array()
38                );
39