dooshan
Member
Posted 5 years ago #
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:
Home
Portfolio
- Customers
- - Company
Contact
when it should be
Home
Portfolio
- Customers
- - Company
Contact
Any idea how I could fix this?
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.
dooshan
Member
Posted 5 years ago #
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 http://www.unofficialaleagueupdate.com.au/?page_id=45 - special editions is three levels deep but I want to keep it highlighted when you are in that section.
iPaulPro
Member
Posted 5 years ago #
Use the CSS selector
current_page_ancestor
eg:
li.current_page_item, li.current_page_parent, li.current_page_ancestor {
font-weight: bold; }
10 hours of work, several plugins later and I find that it all comes down to one little variable:
current_page_ancestor
Genius! Knowledge really is a powerful thing.
So with that input my horizontal menu is finished http://www.colincaprani.com If it would help people I could blog about the solution?
iPaulPro
Member
Posted 4 years ago #
Hmmm.. sorry man - just saw this now. Don't know how I missed your post the first time!!