Archived topic
Aloha! Apply 'Text Current' color to Nav on page?
8 replies · Started by William on June 15, 2017
Aloha!
I have a item in my Primary Navigation called 'Faculty'.
When clicked, it:
1) takes users to a page showing multiple Faculty members (beautiful).
2) lights the menu item (Faculty) up in a color of my choosing (wonderful) - 'Text Current'
Question is ...
When a user clicks a Faculty member photo on said page above, users:
1) go to a page for a the individual faculty member (great).
2) the menu item looses its 'Text Current' color (bummer).
Any way to apply 'Text Current' on an as needed basis?
Mahalo for any insights that can be offered,
Bill
Hi there,
Not sure if this is possible as WordPress needs to see some sort of relationship between the current page and the menu item.
This topic has similar request and Tom explains it: https://generatepress.com/forums/topic/background-colours-of-menus/
Actually I might have a way. Can you provide a link to your site?
Password Protected during development .. Is there a way to share privately?
Much thanks
bill
Is Faculty a top level menu item?
Yes - it absolutely is.
The 12 individual faculty members page are not 'child' of Parent (Faculty) - but can be if needed.
Ok try this:
- Add no-sub to the custom classes field of Faculty menu item:
https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#custom-classes
- Add the 12 individual faculty members page as child items
- Add this CSS:
.no-sub .sub-menu {
display: none !important;
}
.menu-item-has-children .dropdown-menu-toggle {
display: none;
}
.main-navigation .main-nav ul li.menu-item-has-children > a {
padding-right: 20px;
}
Adding CSS: https://docs.generatepress.com/article/adding-css/
- Adjust the px number above to the same as the menu item width:
https://docs.generatepress.com/article/menu-item-height-width/
You, my friend, are an outstanding human being!!
Million thanks!
Hey everybody ... it worked :)
My only hiccup was:
"Add the 12 individual faculty members page as child items" means add them as sub-menu items in the WP nav builder.
I was giving the sub pages a 'Parent' in the page editor (duh) ... until I actually looked at Leo's CSS.
Huge Mahalo!
Bill
You're welcome!