Support » Themes and Templates » current_page_parent, current_page_item but what about three-level menu ?

  • When I’m on the sub-sub page only that menu item and the menu item above in the hiearchy are affected with the current_page styles, not the parent page. Example:

    – – Company

    when it should be

    – – Company

    Any idea how I could fix this?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I’ll take a quick guess and say that might be already reported as an enhancement via Trac Ticket 4351.

    Let me know if I’m wrong about that.

    Thanks, I think that’ll do the trick

    I had to come up with something to do the same thing … here’s what I have at the moment;

    replace the following in classes.php (it’s around line 515).

    $_current_page = get_page( $current_page );
    if ( $page->ID == $current_page )
    	$css_class .= ' current_page_item ';
    elseif ( $_current_page && $page->ID == $_current_page->post_parent )
    	$css_class .= ' current_page_parent';
    $_parent = get_page($current_page)->post_parent;
    $_parentparent = get_page(get_page($current_page)->post_parent)->post_parent;
    if ( $page->ID == $current_page ) $css_class .= ' current_page_item';
    elseif ( $page->ID == $_parent ) $css_class .= ' current_page_parent';
    elseif ( $page->ID == $_parentparent ) $css_class .= ' current_page_parent_parent';

    I’d be very interested to see someone improve this – I don’t really know PHP I just kind of guessed and tried things until got it working.

    Site is – special editions is three levels deep but I want to keep it highlighted when you are in that section.

    Use the CSS selector



    li.current_page_item, li.current_page_parent, li.current_page_ancestor {
    	font-weight: bold; }
    Dr C


    10 hours of work, several plugins later and I find that it all comes down to one little variable:


    Genius! Knowledge really is a powerful thing.

    So with that input my horizontal menu is finished If it would help people I could blog about the solution?

    ::clears throat:: (echo)

    Hmmm.. sorry man – just saw this now. Don’t know how I missed your post the first time!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘current_page_parent, current_page_item but what about three-level menu ?’ is closed to new replies.