In your theme’s functions.php
, write the following code:
<?php
/* ENABLING CUSTOM MENUS
-------------------------------------------------- */
//add_theme_support( 'menus' );
register_nav_menus(
array(
'primary'=>__('Primary Menu'),
'secondary'=>__('Secondary Menu'),
)
);
?>
It’ll register two custom menu area for your theme.
Then you need to achieve it with in header.php
:
<?php wp_nav_menu ( array ( 'theme_location'=>'primary', 'fallback_cb'=>'') ); ?>
This code will place only the Primary Menu area in your theme.
Now you need to code the CSS, and These whole bunch of code is really amazing! I found it from a tutorial site.
Try it and then modify it as per your need, and then find the author of the code (not me) and thanks him. 🙂
Related Posts:
- WordPress security issue to output data from user input from theme option form
- Get Current Menu Location inside Nav_Walker
- How to create a backend for a custom theme?
- Add child pages to submenu automatically
- Create fixed static pages
- Override category archive page title (not the head title)
- How to hide/remvoe unnecessary field/section in post edit section ( Dashboard )
- Post Pagination does not working on WP-Query
- Managing Custom Designed Content
- Invalid Menu Items
- How to give a NavWalker its own stylesheet?
- Elementor custom Query with ACF fields to show matching woocommerce products custom fields
- WP Gutenberg Blocks – How to limit first/root blocks
- How to get boolean value from register_meta properly?
- what is the difference between these phares?
- Form doesnt save to database
- Notice: Trying to get property ‘term_id’ of non-object
- Remove unwanted elements for a wp_nav_menu
- What is the proper method of using global $post?
- Is this best practice for Dynamically adding items to WordPress menus?
- How developed with version control word press site on shared host? [closed]
- How to export post meta with images in wordpress
- Password field is empty when using wp_signon();
- How to remove or add submenu item on plugin activate or deactive
- How to change title tag at page after loaded post?
- Following WordPress Markup Is mandatory, got awkward resultyby wordpress standard markup?
- How do I create plugin or theme using MVC pattern?
- How to limit number of number of categories displayed by categories widget
- PowerPress mobile media player
- When is the proper time to minify css and js with git workflow?
- Where am I doing wrong in my theme menu?
- Strange Situation When Try To Retrieve Github Gist Using wp_remote_get
- How to hide or rename “X” and “x-child” references in website source?
- WordPress custom taxonomy check box to dropdown
- How to Get Current Custom Post Type Associated Taxonomy Term
- Custom code for WordPress dynamic menu
- Plugin templates vs Parent Theme
- Selectively update themes in WordPress multisite
- Auto-Populate Image After Media Upload
- Widget HTML Display Problem
- How do I access the menus produced by Dashboard > Appearance > Menus
- wp_nonce_field displaying twice
- How to make “upgrade safe” theme for a plugin?
- Redirect to another page using contact form 7? [closed]
- Warning: include(): https:// wrapper is disabled in the server configuration by allow_url_include=0
- Admin: sub menu doesnt display under apperance when activate my themes
- Plugin is not generating title tags on any pages or posts
- Is it necessary to do validation again when retrieving data from database?
- How do I combine a theme with a plugin
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- Update Data parameter of a wp_localize_script() call
- Custom entity search and display
- WP Plugin Running before jQuery
- Template directory in plugin
- 3 Level Deep Navigation Menu Not Showing All Levels
- wordpress add_submenu_page adds broken link
- get_the_tags with separator control?
- How to only load css for used blocks on frontend
- 400 Bad Request, in wordpress theme development, wp_ajax
- WP Enqueue style on all plug-in pages
- How to write “alt” tag in image for wordpress code?
- Customize existing menu item
- Why in this archive page that call query_posts() function show only the last 10 posts?
- my own SVN for a plugin/theme
- Issue on Setting $icon_url Parameter on WP add_menu_page()
- Are there any official or unofficial guidelines for the styling of a widget?
- Why enqueue styles on hook?
- How to add menĂą section to my WordPress template?
- Getting a WordPress Debug Strategy
- unable to wp_enqueue_script(‘suggest’);
- Drawing the line between theme & plugin on large scale bespoke projects
- Apply styles to blockquote element with the WYSIWYG editor
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Thesis -style Navigation
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Why would you use esc_attr() on internal functions?
- Invalid hook call on save, not edit when using swiper slider
- Proper way to use useSelect
- Conditional Generation of Image Sizes using add_image_size
- How to add the sidebar to all the pages except the home page? [closed]
- How to add plugin options in wp editor page
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- How to find where an object first instantiatiation
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- Full documentation about $args for register_rest_route?
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- modify show UI of a registered taxonomy
- Using function from enqueued .js file in theme in plugin?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- Does WordPress default CSS have Grids?
- Using HTML links within translatable string
- How to resize WordPress images on upload to specific height and width without cropping it
- Get images / media attached to a page by page ID
- How to get terms for taxonomy
- Why is my container argument not working for wp_nav_menu() [closed]
- How to hide page links from theme menu
- Don’t load the theme for a page FROM a plugin EDITED