I have a category single page in the navigation menu of twenty-thirteen theme. Some CSS rules make an effect for the current menu item.
When I browse the em-category page, I lost “current-menu-item” class.
I tried with other “objects” like location, event, etc. They works well with “current-menu-item”. So I did a little investigation in the “nav-menu-template.php” located in wp-includes folder.
The problem seems come from the function “_wp_menu_item_classes_by_context” around line 484 :
elseif ( <strong>$menu_item->object_id == $queried_object_id</strong> && ( ( ! 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 ) ) )
For a location/event, $menu_item->object_id equals $queried_object_id then the function add “current-menu-item”. However this is not the case for category. I found that category is the only taxonomy in this plugin, so I don’t know whether the problem is related.
As I don’t know what $menu_item->object_id and $queried_object_id stand for, neither how a taxonomy works in the back-end, I’m totally clueless to resolve the problem.
Any suggestion is welcome !
- The topic ‘[EventsManager]Category page lost "current-menu-item" CSS class in nav-menu’ is closed to new replies.