An easier way to go about this: in menu administration, add your custom class directly to the menu item. To enable this, go to Screen Options at the top of the menu editing screen and check the “CSS Classes” box under “Show advanced menu properties.”
Once you check that box, you’ll have a new “CSS Classes (optional)” text input box for each menu item, and you can add it there.
Related Posts:
- Removing container from wp_nav_menu not working
- Check if page is in a certain menu
- Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)
- Show current navigation path from menu
- Is it possible to add classes to list items in wp_nav_menu()?
- How do I fix this error: Warning: invalid argument supplied for foreach()?
- Exclude one item from wp_list_pages( $args );
- different Menu position showing same menu
- How to add bubble count in WordPress wp_nav_menu menu?
- Add class to active top level (grandparent) menu item
- Page not appearing in navigation bar
- Extend WordPress REST API to show slugs for menu items
- WordPress Custom Menu Widget Style
- Output menu navigation in php file
- Custom Post type menu highlighted in the archive/post
- Unclickable Menu Item Label in Custom Menu with Clickable Children
- Remove Metabox from Menus screen
- Sort wp_nav_menu() by menu order
- How to have custom menu Item CSS Classes for wp_page_menu() or wp_list_pages()
- How to fix “Supplied nav_menu_item value missing property” after update to WordPress 5.0
- How to give custom classes to the WordPress Menu widget
- No “current-menu-ancestor” class added when browsing an archive page
- Problems Displaying Multiple WP Menus
- How to add programmatically all pages and children to backend menu
- View h2 content tags of a page in sub menu
- How to add custom classes to more than one separate menu’s a link in wordpress?
- Separator for custom nav menu
- add_submenu_page function to show videos table
- Menu item with no page, but with dropdown
- How to test if blog page is active
- Create a MegaMenu using a walker and the start_lvl function
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- WordPress Plugin menu position overwrite other item
- Change submenu markup
- Get page slug/id from position in menu
- Two different “Home” items in custom menus dashboard section
- How to use a start_el variable in start_lvl
- list category posts under its item in menu
- How to re-arrange the MENU of “Allure Real Estate Theme for Placester” wordpress theme?
- Using _s theme, menu changes do not affect header menu
- Change class-name on “current_ancestor” in wp_nav_menu
- styling wp_nav_menu – horizontal, sub-menu drop downs
- Show children (sub-navigation) of active menu item only
- Make menu items open in new tab/page
- how to change the color of menu text wordpress?
- Switch an entire nav menu if user is logged in
- Pull Menu Items Into an HTML element
- How to pass menu slug as a variable to wp_nav_menu?
- New Menu Item Type Meta Box
- Using Different wp_nav_menu theme_location based on page id (or a parent id)
- Display Menu Navigation Label
- Menu is not displaying on the site navigation [closed]
- Drop Down menu expanded by default (on front page) [closed]
- Dynamically get the meta key value of a menu item based on it’s post ID
- Does this function wp_get_nav_menu_object check if a nav menu exists or is supported?
- How to get current pages menu text?
- Search form as list item in menu?
- Most allowed Taxonomies in Appearance->Menus
- Updated WordPress, now Navigation is Messed Up
- wp_nav_menu removing containing UL with ‘items_wrap’ => ‘%3$s’ not working
- How to show only current item children using wp_nav_menu?
- Option to create menu is missing
- New menu is not showing in api response
- Newly created header is not visible on website
- Copied site has wrong menu URL behaviour
- Nav_walker add id to dropdown ul
- Navbar is hidden behind carousel when using wp-boostrap-navwalker
- Sub Menus will not work
- Active Current Menu – Adding class to child theme
- WPML CMS Nav and Custom Nav_Walker Undefined Property Notices [closed]
- Add data-track to links in menu
- Is it possible to seperate wordpress menu by different div?
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Check in walker if current page is descendant
- Add a non-dynamic phrase/character after a page title?
- Primery Menu Configuration problem
- how to display wordpress navbar with top menu outside wordpress system
- Active page link not getting class assigned
- Menu not saving in dashboard
- Menus not showing in the admin menu, after save
- Customize Walker_nav_menu to show posts if item is category
- How do i keep my current page menu highlighted on pagination?
- Add Protocol to Custom Menus
- How to handle change the appearance of ‘categories’ box on dashboard?
- Pick out specific menu item from code
- Show All Children of WordPress Menu
- menu doesn’t show in different languages
- How can I stop wp_nav_menu from returning extraneous root links?
- How to make an anchored page in a navigation menu tab
- Change menu item order
- Menu System: Custom Links
- nav tag wrapping around dropdown
- Resolve the debugs
- Formatting WordPress Menus (without bullets, inline with text)
- Change Menu Order
- Active Navigation Class Based on URL on icon
- Rename Menu icon in Twenty seventeen theme
- WordPress Menu – Adding a new dynamic element to the menu
- One item on menu is not clickable when it should be