I definetly suggest you to use WordPress menu feature, is quite easier to implement and you will never need to wory if the user want to rename or add new items.
Just add this to your functions.php:
register_nav_menus(
array(
'main_menu' => 'Main menu',
)
);
Then in header.php or wherever you have the menu add:
<?php wp_nav_menu( array( 'theme_location' => 'main_menu', 'menu_class' => 'the_main_menu' ) ); ?>
You can reuse your CSS classes also, please check the doc.
Related Posts:
- start_lvl Ignored in Custom walker_nav_menu
- Hide main div if wp_nav_menu is empty
- Menu Items Disappearing
- wp_delete_auto_drafts() deletes links in menus
- Check if a menu is empty?
- How to remove a metabox from menu editor page?
- Walker class: Problems with understanding how walk() method can be called without error
- How to create different menu’s for not logged in visitors and for logged in members?
- How to add active class to custom menu using while loop and wp_list_pages
- How can I access the “description” of a menu item?
- How to place login logout link on menu that redirects users back to current page?
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- How can I add a custom class to only nav sub-menu > li > a items in WordPress?
- items_wrap not working
- Style wp_page_menu() items
- wp nav menu: add attributes to menu items [duplicate]
- Have CSS Class Added with `is_page()` WP function
- Run a filter when a walker runs
- Change Navigation Bar based on logged in or not
- Multiple WordPress Menus that will only display all pages
- Input type search in Menu
- WP Walker using custom css classes
- Change list item content in menu navigation to add a child element with specific class
- How can I Add a variable PHP in the Menu Nav
- Where to place PHP code that inserts (or doesn’t insert) menu item?
- Adding an Avatar to the Top Nav Bar
- Automatically adding new post categories to menu
- Unique icons next to each WordPress menu item
- Child page menu in sidebar
- Title Case WordPress Menu Items
- Trying to store submenu items to render out after main menu
- How to change menu order item
- get_the_title() gets printed out twice
- Two menus show up
- Show About and Contact Us page when they’re clicked in the top menu.
- Parsing Menu Items and Blog Posts
- Add login hyperlink to secondary navigation menu
- Add value to new attribute inside WordPress menu items
- wp_nav_menu not working correctly in my underscores theme
- Menu Items fail to save correctly, cause reset of related page metadata
- Dropdown menu for categories
- How to display different submenus?
- How to use wp_nav_menu to create custom dropdown menu?
- Output only links using wp_nav_menu()
- Get css class of menu item in custom menu structure
- How to add aria role and schema markup to custom walker container
- Extend Menu Walker Output
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Show login greeting above sub-menu links?
- Why can’t I add a custom image in my navigation?
- Remove submenu item from list
- How to tell if a user has gone in and created a menu
- Menu not styling. New menus functionality giving me a headache
- Dynamic menu with custom post types
- Add class to ul and li in wp_na
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- Adding markup to sub menu based on class
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- wp_get_nav_menu_items() with ACF
- How to switch between two primary menus (programatically0
- Redirect User when they click Menu Option
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- How to give custom roles the capability to edit one Menu instead of every Menu
- Primary navigation menu with timed items from custom post type
- Difference between “Walker_Nav_menu” and “walker”
- Add parent menu item in sub-menu in custom nav_walker
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Vertical Menu for one page only
- How limit the width of a fixed menu-bar on scroll?
- Pulling a variable into the wp_nav_menu function
- Beyond widget side menu editing, with the php page, custom template
- How to list categories by page id in wordpress
- Two theme locations for two menus, but only one is showing up
- wp_nav_menu doesn’t work in a duplicate server
- How I can add div to menu?
- wp nav menu without label
- Contact form field in wordpress menu
- Add extra markup to WP menus
- How to call a certain object/menubar in a PHP file
- Sidebar current menu item for parent
- Using ‘array’ method in wp_nav_menu causes it to disappear
- How to add a code for lastpostdate after/inside a specific menu link?
- Add the “.current-menu-item” class to tag?
- WP_Nav Highlight Parent Issue
- How to change the menu color
- Can’t remove menu items added by plugin
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Nav Menu Display
- Change order that the menu is generated with wp_list_pages
- I am extending Walker_Nav_Menu: How can I get the number of children elements of the current item?
- How do I modify the with wp_nav_menu()
- Make a permalink to the most recent blog post
- Inserting a shortcode into a genesis menu?
- Custom nav with bootstrap dropdown