Current Menu item not selected in Events page
-
Hi there,
I installed the Events Calendar Plugin in my wordpress site. Apart from some styling issues it is working great. My problem is that in the navigation bar, the Menu Item corresponding to the calendar is not selected as current when the calendar page is selected. The rest of the menu items work as expected.
I debuged the issue as far as I could and found that the problem is that in the fuction ‘_wp_menu_item_classes_by_context()’ in the /wp-includes/nav-menu-template.php file, the calendar will not match any of the conditionals to be assigned the current-menu-item class.
The rest of the pages will match the bellow conditional in that function:
// if the menu item corresponds to the currently-queried post or taxonomy object
} elseif (
$menu_item->object_id == $queried_object_id &&
(
( ! empty( $home_page_id ) && 'post_type' == $menu_item->type && $wp_query->is_home && $home_page_id == $menu_item->object_id ) ||
( 'post_type' == $menu_item->type && $wp_query->is_singular ) ||
( 'taxonomy' == $menu_item->type && ( $wp_query->is_category || $wp_query->is_tag || $wp_query->is_tax ) && $queried_object->taxonomy == $menu_item->object )
)
) {
…but the page from the event calendar will not. I’m using the default page provided by the plugin. I just changed the slug. YOu can see how it looks here: https://literacy.wpengine.com/workshops/
You’ll notice that the rest of the menus work, just not that one.
- The topic ‘Current Menu item not selected in Events page’ is closed to new replies.