Introduce get_post_ancestors(). Add current_page_ancestor class to ancestors of the current page. Props AaronCampbell. fixes #5662

git-svn-id: https://develop.svn.wordpress.org/trunk@7074 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2008-02-27 23:28:18 +00:00
parent 75512587f1
commit 0808c1b9a1
2 changed files with 50 additions and 1 deletions
+3 -1
View File
@@ -551,8 +551,10 @@ class Walker_Page extends Walker {
extract($args, EXTR_SKIP);
$css_class = 'page_item page-item-'.$page->ID;
$_current_page = get_page( $current_page );
if ( in_array($page->ID, $_current_page->ancestors) )
$css_class .= ' current_page_ancestor';
if ( $page->ID == $current_page )
$css_class .= ' current_page_item ';
$css_class .= ' current_page_item';
elseif ( $_current_page && $page->ID == $_current_page->post_parent )
$css_class .= ' current_page_parent';