Menu Navigation – current_page_parent class

Home Forums Calendar Products Events Calendar PRO Menu Navigation – current_page_parent class

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1253795
    Brett Atkin
    Participant

    On the following site, I’m using The Events Calendar. When on the Events home page, the News menu item is getting the “current_page_parent” class assigned to the link. Additionally, when I go to an individual event, the “current_page_parent” is getting applied to the News link and not the Events link.

    http://indianashrm.wpengine.com/

    Why is this happened and how do I fix it?

    Thanks

    #1254391
    Andras
    Keymaster

    Hello Brett,

    Thanks for reaching out and I’m sorry you are having this issue.

    As a first please run a test for conflicts based on this guide to see if any of the plugins or your theme is influencing that. Let me know what you find.

    If the issue persists even with all plugins deactivated (except the calendar one) and with a default theme like twentysixteen, then:

    • check if you have a page set up with the slug “events”, possibly with news as parent
    • if you have the menu set up under Appearance > Menus then check if by chance events is a submenu of anything
    • please send me a screenshot of the following: Dashboard > Settings > Reading page

    Thanks and cheers,
    Andras

    #1255152
    Brett Atkin
    Participant

    Here is a solution to this issue:

    http://bigspring.co.uk/solve-wordpress-active-highlighting-issues-using-custom-post-type/

    I have multiple CPT’s on my site and it fixed them all. If you’re curious, this is the code I used.

    // Active highlighting for CPT's
    // -------------------------------------------------------------------------
    function custom_menu_item_classes_job_board($classes = array(), $menu_item = false){
     
    	// use this format for removing highlighting
        if((is_singular('shrm_job_board') || is_post_type_archive('shrm_job_board')) && $menu_item->ID == 159) {
    		$classes = array();
    	}
    	
    	// use this format for adding highlighting
        if((is_singular('shrm_job_board') || is_post_type_archive('shrm_job_board')) && $menu_item->ID == 351) {
    		$classes[] = 'active';
    	}
    	
    	return $classes;
    }
    add_filter( 'nav_menu_css_class', 'custom_menu_item_classes_job_board', 10, 2 );
    
    function custom_menu_item_classes_events($classes = array(), $menu_item = false){
    
        if((is_singular('tribe_events') || is_post_type_archive('tribe_events')) && $menu_item->ID == 159) {
    		$classes = array();
    	}
    	
    	
    	// use this format for adding highlighting
        if((is_singular('tribe_events') || is_post_type_archive('tribe_events')) && $menu_item->ID == 99) {
    		$classes[] = 'active';
    	}
    	
    	return $classes;
    }
    add_filter( 'nav_menu_css_class', 'custom_menu_item_classes_events', 10, 2 );
    #1256058
    Andras
    Keymaster

    Hi Brett,

    I am happy to see you were able to find a solution for this. Awesome job, man!

    I am going to go ahead and close this ticket. If you have a similar issue or another in the future, please do not hesitate to create a new ticket.

    Good luck with your project!

    Cheers,
    Andras

    PS: If you like our plugins, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
    https://wordpress.org/support/plugin/the-events-calendar/reviews/

     

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Menu Navigation – current_page_parent class’ is closed to new replies.