WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Category page lost "current-menu-item" CSS class in nav-menu

[Resolved] Category page lost "current-menu-item" CSS class in nav-menu

  • 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 (
    	$menu_item->object_id == $queried_object_id && //<- this line
    	(
    		( ! 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 !

    http://wordpress.org/plugins/events-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • angelo_nwl
    NetWebLogic Support

    @angelo_nwl

    can you try settings at Events -> Settings -> Pages -> Event Categories
    And set “Override with Formats?” to NO

    When I deactivate “override with formats”, it shows “You have come to a page that is either not existing or already been removed.”

    caimin_nwl
    NetWebLogic Support

    @caimin_nwl

    Have you tried re-saving your permalinks?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Category page lost "current-menu-item" CSS class in nav-menu’ is closed to new replies.