CSS styling menus to show current page (done automatically)
-
I have seen solutions for this, but none of them that work without custom CSS for each individual page.
I am building my menu with wp_list_pages. So if you are on the home page, I want the home page menu item to be a different color. This is for a custom theme, so I am hoping that this can be done automatically.
What I was thinking was to write PHP that sets a different CSS style if you are on the page listed in the menu.
if (on ‘home’ page) && (menu item == ‘home’)
{
Use highlighted css
}
else
{
Use normal CSS
}But wp_list_pages looks to output everything without being able to differentiate which menu is listed.Would I need to access the DB directly to accomplish this.
I am sure this has been done before – but can not find reference for it.
thx!
- The topic ‘CSS styling menus to show current page (done automatically)’ is closed to new replies.