This can achieve with a nav walker
. I used this. I am stepping according to the mentioned.
- Put
navwalker
(wp-bootstrap-navwalker.php
) in yourtheme root
- Call to the
navwalker
infunctions.php
file.require_once('wp-bootstrap-navwalker.php');
- Create your menu in WordPress Backend (
Appearance -> Menus
) - In your menu area, according to me in
header.php
wp_nav_menu( array( 'menu' => 'main_menu', 'depth' => 2, 'container' => false, 'menu_class' => 'nav navbar-nav navbar-center', 'walker' => new wp_bootstrap_navwalker()) );
`main_menu` is my menu name
Related Posts:
- Bootstrap dropdown nav pills not working with wp_nav_menu()
- How to Create a Custom WordPress Navigation Menu with the Code?
- How to remove dropdown from wp_nav_menu
- wp_dropdown_nav function to list menu items
- Programmatically add a Navigation menu and menu items
- Dynamically exclude menu items from wp_nav_menu
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Call custom field into menu item
- Exclude Private, Draft pages from Primary Nav when using custom menu
- wp_nav_menu always falls back to a menu
- wp_get_nav_menu_items how to exclude sub level menu items?
- Add custom attributes to menu items without plugin
- Add Page ID class to nav menu items
- How do I give class to the dropdown sub-menu in the wp_nav_menu?
- Not able to get current menu ID
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- wp_nav_menu doesn’t generate parent/ancestor classes
- how to automatically generate hierarchical menus from hierarchy of pages?
- Why is ‘nav_menu_item_args’ filter’s $item argument empty?
- WordPress wp_nav_menu with a nav tag
- Add sidebars to navigation menu?
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- Change where navigation bar links?
- Programmatically set current-menu-item using wp_nav_menu
- How to insert custom code into wp_nav_menu structure?
- has_children in custom nav_walker
- Remove li from wp_nav_menu
- Adding post excerpt into navigation menu
- Adding Custom “Current Menu Item” class to navigation?
- Check if menu id = $specific_id – then insert specific
- I am facing a problem with the navigation menu of my website
- Prepend to start of WordPress nav loop
- You do not have permission to create Navigation Menus – Twenty Twenty-Two theme
- Add css class to dropdown
- Creating a navigation menu to see where you are on your website
- current-menu-item class is not added
- Automatically list top level menu item child pages
- Check if menu_item has children or has parent
- wp_page_menu not working right?
- Using Zurb’s Foundation Tabs as WordPress Nav (Active Tab)
- Links do not open from click, only in new tab [closed]
- How to get rid of the home link in nav menu?
- Is it possible to add a dynamic link in the main navigation in a child theme
- display menu as table layout
- Menu Arrow for Child Element
- Adding an external link to wordpress menu
- How to make wordpress nav menu use post custom meta data
- Adding a unique ID to each sub-menu
- Add a counter beside menu item label
- How to add css to single navigation text? [closed]
- add another html tag after li element in wp_nav_menu
- My navigation menu isn’t working. What happened? Please help!
- Twenty Fifteen: Change navigation menu behavior
- Nav menu classes ‘has-dropdown’ but no ‘active’
- Add pages content to startpage through custom menu
- How to add a menu that belongs to parent blog to all child-blogs?
- Blending Foundation’s Tabs with WordPress Nav Menu & Display Active Tab
- Dropdown primary navigation menu not working
- Editing the nav menu?
- Get Each Menu Nav Label of Menus in HTML tag
- Nav Menu: Theme Location not working
- Is it all right to put the whole tag into template_part file?
- How to remove empty line space in navigation menu?
- Is it possible to get_the_post_thumbnail (Featured Image) inside a sprintf function?
- Misleading behaviour on Menu & Theme location
- How can I click the parent menu then redirect to a special URL?
- How do I display menu in header without loosing styles?
- What is inside in $item in start_el function in Walker_Nav_Menu class
- Navigation bar is on live site but nothing under menu so can’t add in a page
- Disable Top Nav Bar on Mobile
- Building a menu from a large number of pages?
- Show thumbnail to category items in wp_nav_menu(), how?
- How to select particular menu position in wordpress?
- Links in new menu don’t work
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- Add dynamic content block to nav section generated by custom walker
- Next/previous a-like single navigation
- Menu not always using correct link
- How to output the menue structured for tabbed navigation?
- Replace Menu Item with Logged in username
- Walker for menus
- WordPress Navigation
- How to add an tag when a menu item is a dropdown(or has a sub-menu) [duplicate]
- Navigation list not correctly styled on pages with custom template (missing .current-menu-item)
- How to add posts with thumbnails to my dropdown menu?
- How was this menu system created?
- Display sub menus as separate lists
- how can i get the page_ID in nav li [closed]
- How do i add logo in wordpress studiopress (glam theme)?
- How to set menu Display location
- Add a page to a subscribers account
- What is the best way to incorporate responsive dropdown navigation menu into custom theme?
- How to add a class directly on a unordered list element that is a primary navigation
- How do I programatically remove Menus?
- Displaying a Custom Avatar in WP Bootstrap Navwalker Menus in WordPress
- Icon not shown in Dropdown menus in Twenty Seventeen Theme
- Is there a way to make it so that I don’t get a hamburger menu, but rather a desktop style nav, when resizing to a mobile size
- Give custom class names to WP nav sub-menu