There are two ways of doing this:
-
Javascript. You could use JQuery to select the
<li>that have<ul>children of class ‘sub-menu’, inserting content, or appending a CSS class which you then style. For example:$('.sub-menu').parent().addClass('myclass') -
PHP, a new walker function. Copy the code from wp-includes/nav-menu-template.php (until approx line 109) into your themes functions.php to create a new walker. Pass this walker as an argument to your menu call. In the modified Walker insert a
<span>for an arrow on a sub-menu level item.function start_lvl(&$output, $depth) { $indent = str_repeat("\t", $depth); $output .= "\n$indent<span class=\"right-arrow\">→</span><ul class=\"sub-menu\">\n"; }This will add a small arrow that you can then style just before the sub-menu list item.
Related Posts:
- Split up wp_nav_menu with custom walker
- Custom Nav walker display current menu item children, or siblings on no children
- Add a custom walker to a menu created in a widget
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Add Javascript to WordPress Menu
- WordPress Menu Custom Walker Class
- add span class inside wp_nav_menu link anchor tag
- Determine if a navigation item has children
- Custom Nav Walker menu – Display children count
- Using string instead of object class instantiation on the walker argument breaks wp_nav_menu
- Adding attributes to link in wp_nav_menu using custom Walker function
- Walker_Nav_Menu: put custom code between a particular
- Show top-level parent with submenu menu walker
- Custom nav walker with different output depending on depth
- Bar separated navigation by extending Walker_Page
- Output the aria-labelledby parameter for a nav menu child
- Custom Nav Walker sub-menu HTML construct
- Customizing a walker menu class
- Add div to specific sub-menu
- How to add ID and class in nav menu walker?
- How to remove trailing tags from wp_nav_menu walker
- How to add parent element’s title to nav menu’s child?
- Custom Walker anchor tag not inheriting attributes
- Indirect modification of overloaded property WP_Post::$classes has no effect
- Check what “type” a menu item is
- How to display dynamic content in start_lvl function
- Add custom text to menu
- How to add a tag to wp_nav_menu in a child theme
- Adding post excerpt into navigation menu
- Use wp_nav_menu to display ALL pages
- Third level navigation class
- Editing WordPress Nav Menu Walker
- How to add a submenu toggle button inside all “li” elements that have a submenu?
- Get top items number from wordpress menu
- add span class and i tag inside wp_nav_menu link anchor tag
- I am facing a problem with the navigation menu of my website
- How to Overwrite/Customize wp-admin/nav-menus.php in WordPress
- Use menu class in walker function
- How do I separate link levels in a custom menu walker?
- Add within the output of
- wp_list_pages() but only show children on the branch you are on
- Walker class conditional based on parent menu item label or custom css class
- Sub Menu does not display using Nav Walker
- Is this format possible with a custom Nav Walker class?
- Put class on instead li
- Get Menu Name inside walker
- Static page to one page- menu inactive items highlighted
- Add code to WordPress menu items by class
- WordPress Menu Walker: add #hashes to child page links (only)
- WordPress Walker – Group two items?
- Difference between walker class and basic php
- Where to implement custom walker class?
- custom walker class
- Custom navigation structure with walker class
- How do you add a around the second level of a Menu?
- Page content loading issue using Walker_Nav_Menu
- How to add class to parent a tag with a sub menu
- Walker Class – Check if menu item has description and if so add class to li
- Help with walker for nav
- How to actually make menu walker alive on admin interface?
- Why is only the first operation run in my loop – except for on the last repeat? [closed]
- Displaying Nav Menu
- Wrapping menu’s top-level link and sub-menus in div
- Remove a class from a using Walker
- wp_nav_menu: Is there a way to modify the output of that got a submenu?
- Custom menu walker – remove li tag based on class name
- How to convert the argument of wp_list_pages to an array
- How to change the menu mark up with walker_nav_menu class?
- changing the labels inside appearance -> menus for some for the fields
- How to get current pages menu text?
- Costum walker with sub menu item count
- Hook or callback when wp_nav_menu() has completed
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- How to include second layer sub menu to Walker Nav?
- Event listener callback returns undefined element
- Cannot collapse a responsive menu in WordPress
- How can I creat custom menu with bootstrap
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- Multi-Level Nav Bar
- Nav_walker add id to dropdown ul
- How to create a mobile menu full screen overlay using Understraps Bootstrap 4 theme
- Change markup for just 2nd list element in custom Walker menu
- Menu walker: how to tell if a sub menu contains submenus?
- How to remove a sub-menu using walker hooks/filters without relying on a custom walker?
- Extending Walker_Nav_Menu in wp_nav_menu List of Empty Items
- Parent link need to go first child submenu
- Custom wordpress submenu
- Walker or wp_get_nav_menu_items VS jQuery
- WPML CMS Nav and Custom Nav_Walker Undefined Property Notices [closed]
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- Is it possible to separate all submenu items?
- Check in walker if current page is descendant
- Specific Page that convert Hyperlink to anchor in nav menu
- Showing a link with Javascript based on log-in status
- Customize Walker_nav_menu to show posts if item is category
- How do i keep my current page menu highlighted on pagination?
- Jquery dropdown menus working locally, but not in WordPress [duplicate]
- Active Navigation Class Based on URL on icon
- Override theme hamburger menu to work without javascript (noscript)