First step is to register the name (or names) for your menus. In your example, top-nav seems appropriate.
function vd_register_menu() {
register_nav_menu('top-nav',__( 'Top Nav Menu' ));
}
add_action( 'init', 'vd_register_menu' );
This will allow you to build your menu items in the WP admin under Appearance > Menus.
To display your menu on the site, simply call the wp_nav_menu() function where you wish to print the code.
<?php wp_nav_menu( array( 'theme_location' => 'top-nav' ) ); ?>
Full documentation available via WP Codex: https://codex.wordpress.org/Navigation_Menus
Related Posts:
- start_lvl Ignored in Custom walker_nav_menu
- add_filter the_content str_replace after shortcode
- What exactly does “Posts page” do in WordPress?
- WordPress Ajax always returns a 404 error
- Adding a search form inside a div
- Load custom field value into div with AJAX
- Blank on static home page?
- How to use SRCSET with get_the_post_thumbnail()?
- How to use a frontend URL with a Plugin
- How do I make wordpress comment fields required?
- How to display blog images using wordpress in existing project
- WordPress Wysiwyg Content not being displayed
- Javascript code inside “” in core WordPress files .php
- How to display a value from a radio button in the options menu in wordpress
- How do I add HTML to a PHP function [closed]
- Custom image upload
- How to display recent posts on home page with custom HTML
- WordPress automatically adds tags when pasting code, how to stop it?
- Slide in Panel WordPress Post
- Removing unneccessary p-tags (Not every p)
- WordPress automatically adding html tag around PHP code
- Missing sidebar parameter “fix” – before_content
- How to get the POST TITLE using the POST ID?
- Load a page into a div with Ajax
- My form action url is being prepended with a directory that does not exists
- Converting HTML Template to WordPress Theme
- Multiple options not staying selected after saving
- custom fields wordpress
- Why the JavaScript code is ignored from wp editor?
- Populate dropdown with Child Pages based on Parent Page chosen
- How to change redirection route to a php page for making it only accessible by logged-in members?
- How to remove ?wp-mce-4103-20162941
- Why Won’t My Inputs in a form with a Get method work together?
- parts of url disappear when using # inside href=”” [closed]
- How to get the value of input hidden html from text editor to custom page template?
- Dot is not added at the end of href
- Add .htm extention to a custom taxonomy
- Make PHP work with HTML tags
- Is this spyware on my site or a real Java update?
- Search WordPress using static html page
- Function returns text instead of html [closed]
- How i can get post data from database when i am getting post id from url in wordpress
- WordPress plug-in for dynamic download link?
- How to remove the h6 tag for the entry-category Class
- Override user-edit.php to design own profile page
- Where can I find the inline-css of my theme header?
- Make textarea required. Help [closed]
- Menu Custom Data Attributes
- Highlight the links without using dropdown
- How to turn each phone number within the $content to a telephone link?
- Creating custom page template from existing PHP site
- wordpress site – using custom database and PHP
- How do I access post_meta key with php?
- Separate array output into a
- Website completely messes up when logging out
- Calling PHP Titles inside Javascript Markup
- How can I use custom menus with a Bootstrap WordPress theme?
- Remove in post content
- Adding attribute to the post.php form tag in wp-admin
- Using php inside javascript [closed]
- Replacing WordPress Icons (menu,icons32, etc)?
- WordPress custom post type and taxonomy
- Search AJAX Filters – Multiple Query Loops Into One Loop (Optimization)
- Display WordPress search results based on the selected Sub-Category
- HTML Form Question
- How do I call a value from the datase using ajax
- Hide A Class and Add Custom HTML Code Using WordPress
- Fatal error login WordPress [duplicate]
- How to use data URL in WordPress?
- Help me I cannot link my font-awesome to my WordPress Theme. I have my font-awesome folder already in my project
- How to use wp_ajax_set_post_thumbnail?
- Passing a value from an input field to a php function in WordPress?
- Comparison operator != not working in field [closed]
- Custom woocommerce payment gateway – Form
- Problem with my Login Plugin
- How to return html as a string from php for WordPress
- Show subcategory name selected in specific category woocoommerce
- Make a full-width wordpress page
- Display child-page links in sidebar on both Parent Pages AND Child Pages
- Unable to insert current username into custom table through html form
- Add Text Area To Child Theme’s Home Page
- Splitting table data to pages with numbers
- how to remove replicating a tag inside loop?
- Add Alt attribute to image served with php
- How to add thumbnails from recent posts to owl-carousel in wordpress automatically?
- echo variable containing html and the_permalink();
- nested divs, classes for a grid in loop [duplicate]
- featured post as div background
- Trying to customize wordpress drop down categories
- how to manipulate HTML parameters using PHP conditions
- Display wordpress post to static website in the footer
- Php echo into tag
- Parse error: syntax error, unexpected ‘echo’ (T_ECHO) in C:\xampp\htdocs\AttendanceSystem\resources\php\method.php on line 250 [closed]
- How to edit homepage in WordPress?
- Load Meta box value into div AJAX [duplicate]
- WP_Query not returning results
- Advanced Custom Fields Show PHP in Text Areas
- Is there a better way to output HTML as a shortcode?
- Remove post image caption from post_excerpt();
- How can I change text on my SearchWP search results page, as this is not an editable page in WordPress?