Assign the menu to a string:
$menu = wp_nav_menu(
array (
'echo' => FALSE,
'fallback_cb' => '__return_false'
)
);
if ( ! empty ( $menu ) )
{
echo '<div class="navmain2">' . $menu . '</div>';
}
Related Posts:
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Displaying Logged-In User Name in WordPress Menu
- Check if a menu is empty?
- How to remove a metabox from menu editor page?
- Hide a menu-item and its submenus and display a ‘Log in’ link if the user is logged out
- The best way to customize “nav-menu-template.php” to add if the ‘link_before’ is “checkbox”
- How to add active class to custom menu using while loop and wp_list_pages
- WordPress menu deletes when trying to add a hook
- Logout and redirect using the WP Menu
- Have CSS Class Added with `is_page()` WP function
- Add itemprop Schema.org Markup to li Elements in wp_nav_menu
- Run a filter when a walker runs
- Menu — How to add “current-menu-grand-ancestor” css class
- Hide Hamburger Menu On Specific Page (Front Page/Home Page)
- Automatically adding new post categories to menu
- Add data attribute to each li in menu
- Unique icons next to each WordPress menu item
- Child page menu in sidebar
- Title Case WordPress Menu Items
- WordPress Quick Question . How to Get Parent Link in Submenu in My Code
- Detecting classes, adding widgets, and adding divs in with a Nav Walker
- How to change menu order item
- Add item to top of menu using a filter in functions.php
- Register a menu – Error Header
- Add login hyperlink to secondary navigation menu
- Add value to new attribute inside WordPress menu items
- Get the name of menu item with wp_nav_menu
- How to add aria role and schema markup to custom walker container
- How can I use custom menus with a Bootstrap WordPress theme?
- Nav-Menu not showing up
- Remove submenu item from list
- Dynamic Menu drops pages?
- Menu not styling. New menus functionality giving me a headache
- how to changes mobile menu toggle breakpoint in WordPress
- How to display already created menus via php?
- Providin exception to WordPress wp_nav_menu Custom CSS Classes
- How to put 2 php codes in functions.php without site crashing
- Menu not updating for logged in users after redirect
- Add element after navigation element title don’t works like I expect
- 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?
- Pulling a variable into the wp_nav_menu function
- How I can add div to menu?
- WordPress adding in site URL to header links
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- How to add different menu items on different menus?
- Removing Default Gutenberg Blocks, But Keeping Reusable Block Functionality?
- How to override an unpluggable parent theme function?
- Can i check if user is doing any ajax request?
- Displaying post per day
- How to Populate the list of custom post type categories
- Php string not working in WordPress Functions.php [duplicate]
- Understanding WordPress child theme custom JS loading
- Problem with ACF shortcode with Repeater Field in WordPress? [closed]
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- Insert After Second Paragraph Without Tag?
- page template for attachement page?
- PHP Deprecated: WP_RSSjb has a deprecated constructor
- Removing unneccessary p-tags (Not every p)
- Showing content from one page on another
- How to insert a single row to WP database table?
- Get date numerical and separate?
- How can I Add a variable PHP in the Menu Nav
- Adding an Avatar to the Top Nav Bar
- How to add seperate classes to no-search-result and found-search-result pages on wordrpess search – is_search()
- How to check if a meta value has already been assigned to any user?
- A non-numeric value encountered in /wp-includes/functions.php on line 68
- Ajax load more button for comments wordpress
- Update user profile information from functions.php
- How to fix this warning:call_user_func_array() expects exactly 2 parameters, 1 given in D:\wamp\www\…….\wp-includes\class-wp-hook.php on line 286
- How to set the WordPress logo programmatically with PHP
- Function works everywhere, how to keep it to execute when creating a new post
- Function won’t run onclick using Ajax
- List all blogs, but exclude the main site
- Reading settings in the home page precisely home.php
- Calling function in loop causes repeat data
- How to use wp_nav_menu to create custom dropdown menu?
- Is there a hack for using is_page() within the function.php file?
- Add a select-option to the default widgets
- WP-Bakery – Add custom colors to buttons with template colors
- WordPress User Meta value variable into Google Gauge Chart
- Show all people who commented on all posts by an author
- Custom global variable not working in function
- dynamic php menu with hidden sub-categories only showing when the category name is clicked
- Embed video from streamtape using direct link
- get_the_author_meta( ‘ID’ ) just return 1
- Site title not showing. Please help me
- Check if post visited first time
- Store custom field’s multiple values in one user meta key
- Need to Echo A Url path to show on a wordpress page
- Restrict File Type Uploads by User on Wordress via functions.php
- How to Request a User to Register on Landing at a Site, Then Automatically Delete the Users Password on Logout?
- How to list categories by page id in wordpress
- AJAX Returning Way Too Many Posts
- wp_nav_menu doesn’t work in a duplicate server
- How to get category pages to look like a certain archive page?
- Select area and checkbox data is not saving?
- How to modify this function to exclude also the post belonging to a specific category?
- Suppress errors when using global function