Articles of menus

Searching for a category returns nothing if category is empty

In the navigation menu creation page, when you are trying to add a category to the menu, if the category is empty, it won’t show up in the search results. However, if the category itself is empty but has a child that is not empty, it will still be shown. I have a blog with […]

Display Username as parent menu item

Using this code: add_filter( ‘wp_nav_menu_items’, ‘my_custom_menu_item’); function my_custom_menu_item($items) { if(is_user_logged_in()) { $user=wp_get_current_user(); $name=$user->display_name; // or user_login , user_firstname, user_lastname $items .= ‘<li><a href=””>Welcome ‘.$name.'</a></li>’; } return $items; } I am able to display the current logged in user’s display Name into the navigation, but it replaces the current menu items. What would I need to […]

Full screen nav menu block with avada theme

I have a menu structured exactly how I want it but I need the style to be a bit more refined and specific. I’m using the avada theme with mega menu functionality, and I’ve applied it to the first link here: However, I want my dropdown to be full width completely and house the […]

Get the name of menu item with wp_nav_menu

Basically I’m customizing the menu through the options of wp_nav_menu(). Here is some of my code: function custom_novice_menu($args) { $args[‘container’] = false; $args[‘container_id’] = ‘my_primary_menu’; $args[‘link_before’] = ‘<div class=”topic-card”><div class=”topic-circle”></div><span></span><h3>’; $args[‘link_after’] = ‘</h3></div>’; return $args; } Essentially I want to get the name or ID of the current menu item. That way I can use […]

Secondary Navigation Menudisappeared When using wp_nav_menu_items

My Secondary Navigation Menu works fine until I use add_filter( ‘wp_nav_menu_items’) to add a login / logout button to my primary menu. Here is my code: add_filter( ‘wp_nav_menu_items’, ‘add_loginout_link’, 10, 2 ); function add_loginout_link( $items, $args ) { //Add item to primary menu if ($args->theme_location == ‘primary’) { //checks if user is logged in if […]

Dynamically add sub-categories to any category in the menu

I have a menu with a combination of pages and categories. I need to loop through the menu and if it finds a category automatically add all child-categories as a submenu. Page 1 | Page 2 | Custom Link Category 1 Category 2 Child Category In the example above I need to dynamically add the […]

How to add Plugin functionality in WordPress Frontend Menus

In Plugin, I have made Custom Category for Products. Its Simply CRUD for Category and Category Wise Products. So now i want to add these Categories in WordPress Frontend Menus. So it can be used for frontend. So how can i do this? Thanks in adv.

Creating menu always gives error A name is required for this term

I have 2 menus. Main Navigation Footer Navigation And 3 locations: Top Bar Navigation Main Navigation Footer Navigation If I try to create a new menu, wp displays error A name is required for this term. Obviously I am giving a name in Menu Name textbox… Is this a bug? Is there a limit to […]

How to include a third level with wp_get_nav_menu_items function

I’m trying to create a custom menu structure that will work with jquery push menu’s. All is working fine with the 1st and 2nd level. If I try to add a third level to my menu, everthing goes weird. Obvoiusly this is due to the function only accounting for a second level. But unfortunately […]

How to automatically redirect to first item of second navigation level in a multi-level menu?

I have a use case where my WP install is a bunch of pages with sub-pages. For example: HOME ABOUT – ABOUT US – HISTORY – PEOPLE – AWARDS PRODUCTS – PRODUCTS – INGREDIENTS – PROCESS I would like to establish a structure where clicking on the 1st level navigation item (“About”) takes you to […]