Events page and the current-menu-item CSS class
-
For a reason that is unclear to me, an Events page that uses the archive-event.php page template AND is manually added to the menu using the WordPress Appearance > Menus admin page is NOT automatically assigned either the .current-menu-item or the .current_page_item CSS class by WordPress.
This was causing CSS menu styling headaches on several sites where that menu styling made a difference due to the themes I was using.
A couple days ago I stumbled on a work-around quite by accident. Just for kicks I used the “Add an ‘events’ link to the navigation menu:” option found in the Events Organiser General settings tab to add the Events link to the menu, and WordPress assigned it the correct CSS classes. Excellent!
I had avoided this option in the past because of the warning next to it that reads “(This may not work with some themes):”, and because I prefer to manually add menu items to the menu.
What I noticed on the Appearance > Menus admin page for that menu was that the new Events menu item (added by the plugin) is designated as “Custom” instead of as “Page”.
I haven’t dug into this to see why this is happening, but for now it’s good to know that there is a way to make the CSS work properly.
For the record, this was a Genesis theme that I was using.
https://www.ads-software.com/extend/plugins/event-organiser/
- The topic ‘Events page and the current-menu-item CSS class’ is closed to new replies.