Home › Forums › Calendar Products › Events Calendar PRO › Menu Navigation – current_page_parent class
- This topic has 4 replies, 3 voices, and was last updated 9 years, 1 month ago by
Brett Atkin.
-
AuthorPosts
-
March 14, 2017 at 7:46 am #1253795
Brett Atkin
ParticipantOn 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
March 15, 2017 at 5:09 am #1254391Andras
KeymasterHello 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,
AndrasMarch 16, 2017 at 9:15 am #1255152Brett Atkin
ParticipantHere 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 );March 17, 2017 at 1:37 pm #1256058Andras
KeymasterHi 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,
AndrasPS: 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/ -
AuthorPosts
- The topic ‘Menu Navigation – current_page_parent class’ is closed to new replies.
