The easiest way is to use the register_nav_menus
function.This should be hooked into 'after_setup_theme'
:
function my_cool_menu_function(){
register_nav_menus( array(
'primary' => 'Primary Navigation'
));
}
add_action( 'after_setup_theme', 'my_cool_menu_function' );
Then, in your theme, simply call that menu’s position:
wp_nav_menu( array( 'theme_location' => 'primary' ) );
Related Posts:
- Any official way to create an admin theme?
- Creating Multiple Menus when using the TwentyTen Theme?
- How to find out if page_for_posts is showing (in order to style menu item)
- How to create different navigation for registered users in WooThemes Canvas?
- How to remove the tripadvisor logo from the wordpress theme?
- Make a menu item unselectable
- How can I fetch the next level of the currently selected main menu (hierarchical menu)?
- Custom theme – pages in menu
- Theme Options Menu Item – Permission Issue
- Lightword Theme – only one menu item
- Opinions and recommendations on the best barebones base theme [closed]
- Adding admin-ajax.php to the frontend. Good or bad idea?
- what the best way to include images from the template’s images folder?
- What is meant by __(‘page’,’twentytwelve’)
- Adding Language Support using .pot and .mo files to a WordPress Theme?
- Moving WordPress.com theme and widget settings to self-hosted site?
- Getting headers property from WP_Theme object
- Which settings/options are saved on a theme-basis and how does this affect theme-switching?
- WP admin bar only on some pages
- What does “Trying to get property of non object in..” mean?
- How to delete default themes
- Problem : deletion failed, the theme requested does not exist
- Download all WordPress.com available themes, somewhere?
- How to stop a 500 error on the WordPress theme folder
- Change Theme from Plugin based on query_vars
- How to mark an option as selected
- Archiving annual festival site
- How to know the theme name of a wordpress blog?
- Theme Development Admin Area [closed]
- adding multiple sidebars on pages
- Varying Search Result Pages
- How to know if user choose to show full post or excerpt?
- .htaccess edits
- Investigating complex themes still slow even with WP caching
- Theme settings default, strange behavior before first save
- Is that worth it to find a designer for creating a WordPress theme for selling on ThemeForest? [closed]
- Howto keep header image when changing theme
- setting a different theme for specific category in wordpress
- Get name of current page template in Gutenberg era
- Mobile issue – website isn’t properly detecting screen size [closed]
- Child Theme not overriding a template section on live site – but is on local site
- Online theme customizer missing details
- Redux callback action
- Navigation label for page in custom theme
- Problem of running development copy of WordPress on WebMatrix?
- translation does not work for ‘Home’
- Should I implement my own custom theme
- How to translate a string that contains a WordPress sitename
- Advantages of wordpress theme vs wordpress as a backend only [closed]
- Is that a malicious code?
- How can my user make their own Blog/Diary
- Where do I find (free) fully-internationalized themes? [closed]
- How do I manually revert back to my old theme?
- Modifying the markup in the Tag Cloud widget?
- How to trace and resolve a theme problem such as flickering links in WordPress? [closed]
- Child theme looks different from parent theme, and incorrectly displays parts
- Adding an extra sidebar to your theme
- Theme modification for custom category menus
- Widgets not showing on sidebars
- linking to an svg through comments_popup_link
- How to use custom page templates in a theme that hides page template option?
- Why in this WordPress theme I can’t see the Main Menu?
- Create Custom Attachment Template That is Processed from Plugin Folder?
- my blog crashes ie7?
- How would I got about calling a php file every time someone publishes a new post?
- remove preloader in WordPress theme [closed]
- Flexslider in child theme
- How to edit the default comment title?
- Why my function.php file in theme delete automatically? [closed]
- How to reverse the pagination numbers of an archive?
- Theme translates the_author_posts_link. How can I remove their translation?
- Theme CSS missing completely
- How to implement this layout?
- WordPress customizer extremely slow, cant work in it
- Missing privacy policy checkbox on login page (using Enfold theme)
- How exactly does WordPress load themes from api.wordpress.org?
- Themes don’t show up in the dashboard -> Appearance -> Themes
- Let custom text widget use the same font as the theme
- SSL errors when I activate my custom theme
- How to show taxonomy in WordPress shortcode
- wordpress theme link url
- Route to custom file
- “Template is missing” install error on non-child theme
- wordpress template page Usage [duplicate]
- No “available widgets” (wordpress 3.2.1 multisite)
- How to create a second index.php?
- how to use Easy Docs theme to write a book?
- How to create an Single-Portfolio page?
- 2 WP websites same content different themes
- How is WordPress child related to Buddypress child theme
- “Parse error: syntax error, unexpected” and the WordPress Theme Editor no longer working!
- Define a Custom Template Part As A Widget Area
- Changing Sidebar In 2023 Theme
- register_nav_menus syntax error, unexpected identifier “register_nav_menus” in
- My theme is not translated
- Wrong theme being activated
- RTL in posts only [closed]
- Blocking Google Fonts in wordpress website
- I am unable to remove “© 2022 My Blog | PopularFX Theme ” from footer [closed]
- Workaround AJAX calling without directly calling WordPress backend (Admin dashboard) because it is restricted to the end user (the public)