Make WordPress Core

Ticket #9304: page_css_class.diff

File page_css_class.diff, 1.7 KB (added by wnorris, 16 years ago)
  • wp-includes/classes.php

     
    11721172                        $indent = '';
    11731173
    11741174                extract($args, EXTR_SKIP);
    1175                 $css_class = 'page_item page-item-'.$page->ID;
     1175                $css_class = array('page_item', 'page-item-'.$page->ID);
    11761176                if ( !empty($current_page) ) {
    11771177                        $_current_page = get_page( $current_page );
    11781178                        if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
    1179                                 $css_class .= ' current_page_ancestor';
     1179                                $css_class[] = 'current_page_ancestor';
    11801180                        if ( $page->ID == $current_page )
    1181                                 $css_class .= ' current_page_item';
     1181                                $css_class[] = 'current_page_item';
    11821182                        elseif ( $_current_page && $page->ID == $_current_page->post_parent )
    1183                                 $css_class .= ' current_page_parent';
     1183                                $css_class[] = 'current_page_parent';
    11841184                } elseif ( $page->ID == get_option('page_for_posts') ) {
    1185                         $css_class .= ' current_page_parent';
     1185                        $css_class[] = 'current_page_parent';
    11861186                }
    11871187
    1188                 $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
     1188                $output .= $indent . '<li class="' . implode(' ', apply_filters('page_css_class', $css_class, $page)) . '"><a href="' . get_page_link($page->ID) . '" title="' . attribute_escape(apply_filters('the_title', $page->post_title)) . '">' . $link_before . apply_filters('the_title', $page->post_title) . $link_after . '</a>';
    11891189
    11901190                if ( !empty($show_date) ) {
    11911191                        if ( 'modified' == $show_date )