Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Keep Parent Item Active when Child Element is Current Page – CSS/WordPress Re: Keep Parent Item Active when Child Element is Current Page – CSS/WordPress

#106772
ChrisxClash
Member

Wordpress adds the super helpful selectors that do that for you. Try doing this:


.current_page_parent {
// parent styling here
}

.current_page_item {
// child styling here
}

This should work for any page that you’re on.

Edit: After looking at your css, it looks like you’re actually already using those selectors, however you’re not coloring their backgrounds, only the text. So if you use those along with background it might help out?