You need to set-up your own menu walker (link to WordPress Codex), and in there add custom start_el
and end_el
overrides. So for example your start_el
and end_el
may look something like this:
function start_el(&$output, $item, $depth=0, $args=array()) {
$output .= "<div>" . esc_attr($item->label);
}
function end_el(&$output, $item, $depth=0, $args=array()) {
$output .= "</div>\n";
}
This tutorial might be useful too:
https://code.tutsplus.com/tutorials/understanding-the-walker-class–wp-25401
Related Posts:
- Split up wp_nav_menu with custom walker
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Display only page specific sub menu items using Custom Walker
- WordPress Menu Custom Walker Class
- Call custom field into menu item
- Add class to top level menu item if it has multiple child levels
- Determine if a navigation item has children
- Simple Navigation Walker – Wrapper-class around first sub-menu
- Add Page ID class to nav menu items
- Pass a parameter to a menu walker
- Bar separated navigation by extending Walker_Page
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- Customizing a walker menu class
- How to add ID and class in nav menu walker?
- How to add parent element’s title to nav menu’s child?
- wp_nav_menu – page template name as item class
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- Use walker for specific menu, or avoid use of walker
- Add custom text to menu
- has_children in custom nav_walker
- 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?
- How can I add divs or change li in the submenu of the menu_nav
- Get number of root elements in walker class
- Get top items number from wordpress menu
- add span class and i tag inside wp_nav_menu link anchor tag
- How to Overwrite/Customize wp-admin/nav-menus.php in WordPress
- Remove current class from sub menu items
- View h2 content tags of a page in sub menu
- Change an li class name in a wordpress custom menu walker
- Use menu class in walker function
- Custom walker nav – Add sequential number as class
- Getting menu items like get_pages
- 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
- How to create this Custom Walker Menu
- Sub Menu does not display using Nav Walker
- Put class on instead li
- Get Menu Name inside walker
- WordPress Menu Walker: add #hashes to child page links (only)
- WordPress Walker – Group two items?
- Where to implement custom walker class?
- custom walker class
- wp_nav_menu add class to child item with sub child
- How to use a start_el variable in start_lvl
- Page content loading issue using Walker_Nav_Menu
- Split into two seperate unordered lists with custom walker
- creating a custom walker class
- Walker Class – Check if menu item has description and if so add class to li
- How to add attribute in menu code
- How to remove dropdown from wp_nav_menu
- Walker menu not displaying at all
- Wrapping link and .sub-menu with wp_nav_menu
- wp_nav_menu check both hierarchy fail?
- Adding a unique ID to each sub-menu
- Show Sidebar Menu Subpages When Clicking Parent
- How can I make wp_nav_menu() support tags?
- How to Add support for sub-menu item description in wordpress?
- Walker Class: Output Parent Description and Featured Image right after sub-menu?
- Modifying the walker to insert parent’s description above sub menus
- How to add scroll IDs to WordPress menu anchors
- wp_list_pages Hierarchical Help
- custom walker class for own menu?
- Adding a tag to wp_nav_menu
- Add attributes to wrapper html generated by wp_nav_menu
- Why is my navigation in my onepage not working?
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- WordPress menu walker – help to add custom class for each submenu
- Need help with Walker_Nav_Menu class
- why are my walker menu is showing like this?
- Stuck while adding bootstrap navwalker class
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Add active class to wp_nav_menu
- Classes CSS (Optional) – how do I reference this in php?
- Displaying a part of a menu containing the page the user is currently viewing and only it’s immediate children
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Cannot add home page url to menu with #
- Show post titles within WordPress bootstrap Dropdown menu
- Add parent link to its submenu
- Creating custom Menu for custom theme
- Count Level 1 Childs for Custom Nav Walker WordPress
- Add dynamic content block to nav section generated by custom walker
- Need direction on a seemingly complex menu walker for automatically inserting a parent link li in it’s submenu ul
- Additional class for.sub-menu UL?
- How can I modify wp_nav_menu with walker?
- Walker for menus
- Use wp_nav_menu to dynamically generate child menus
- how to make a walker to this (in bootstrap, i try but not work)
- Broken drop down menu using Bootstrap and navwalker class
- how can i get the page_ID in nav li [closed]
- Custom navigation / menu output (walker?)
- Using walker to display all menu branches at once?
- WordPress nav Walker – Bootstrap 5.2.3 – submenu not opening