
Since it is a distinguished location in a typical WordPress web site format, it’s sensible to make the most of it by inserting customized objects aside from plain hyperlinks within the menu.
As an illustration, some customers could wish to show the search type like we do at WPBeginner. A membership web site could wish to present login and logout hyperlinks, or you could wish to add icons or photos to your menu.
By default, navigation menus are designed to show plain textual content hyperlinks. Nonetheless, you may nonetheless place customized objects in WordPress menus.
That being mentioned, let’s check out how one can add customized objects to particular menus in WordPress whereas holding the remainder of your navigation menu intact.
Including Customized Gadgets to Particular Navigation Menus in WordPress
There are other ways so as to add customized objects to a navigation menu in WordPress. It depends upon what sort of customized merchandise you are attempting so as to add.
We’ll present you a number of the commonest examples. You’ll want to make use of plugins for a few of them, whereas others would require you so as to add some code.
If you wish to skip forward to a sure part, you need to use this desk of contents:
- Add a search popup to your WordPress menu
- Add icons or photos to your menu
- Add login/logout hyperlinks to your menu
- Add customized textual content to a WordPress menu
- Add the present date to the menu
- Show usernames in your menu
- Present completely different menus on completely different pages
Let’s get began.
1. Including a Search Popup in WordPress Menu
Usually, you may add a search type to your WordPress sidebar by utilizing the default Search widget or block. Nonetheless, there isn’t any approach so as to add search to the navigation menu by default.
Some WordPress themes have an possibility so as to add a search field to your principal menu space. But when yours doesn’t, you need to use the strategy beneath.
For this, it is advisable to set up and activate the SearchWP Modal Search Kind plugin. For extra particulars, see our step-by-step information on set up a WordPress plugin.
This plugin is an addon for SearchWP, which is the greatest WordPress search plugin in the marketplace.
The addon is free and can work with default WordPress search as properly. Nonetheless, we advocate utilizing it with SearchWP if you wish to enhance your WordPress search.
After putting in the addon, merely head over to the Look » Menus web page. Beneath the ‘Add menu items’ column, click on on the ‘SearchWP Modal Search Forms’ tab to develop it.

Choose your search engine after which click on on the Add to menu button.
The plugin will add the search to your navigation menu. Click on on the ‘Modal search form’ underneath your menu objects to develop it and alter the label to Search or the rest you need.

Don’t overlook to click on on the Save Menu button to retailer your modifications.
Now you can go to your web site to see Search added to your navigation menu. Clicking on it’ll open the search type in a lightbox popup.

For extra particulars, see our information on add a search button to a WordPress menu.
2. Add Icons and Customized Photographs to Particular Menus
One other well-liked customized merchandise that customers usually wish to add to a selected menu is a picture or an icon.
For that, you’ll want to put in and activate the Menu Picture Icon plugin. For extra particulars, see our step-by-step information on set up a WordPress plugin.
Upon activation, go to the Look » Menus web page and transfer your mouse over the menu merchandise the place you wish to show an icon or picture.

Click on on the blue Menu Picture button to proceed.
It will carry up a popup. From right here, you may select a picture or icon to be displayed with that menu merchandise.

You may as well select the place of the picture or icon with respect to the menu merchandise. For instance, you may show the icon proper earlier than the menu merchandise like in our instance beneath, and even conceal the menu title so solely the icon reveals.
Don’t overlook to click on on the Save modifications button to retailer your settings. Repeat the method if it is advisable to add icons or photos to different menu objects.
After that, you may go to your web site to see the customized picture or icon in particular menu objects.

For extra detailed directions, see our tutorial on add photos in WordPress menus.
3. Add Login / Logout Hyperlinks to Particular WordPress Menu
In case you are utilizing a WordPress membership plugin or operating an on-line retailer, then you could wish to permit customers to simply log in to their accounts.
By default, WordPress doesn’t include a straightforward technique to show login and logout hyperlinks in navigation menus.
We’ll present you add them by utilizing a plugin or by utilizing code snippet.
1. Add Login / Logout Hyperlinks to Menus utilizing a Plugin
This methodology is simpler and really useful for all customers.
First, it is advisable to set up and activate the Login or Logout Menu Merchandise plugin. After that, it is advisable to go to the Look » Menu web page and click on on the Login/Logout tab to develop it.

From right here, it is advisable to choose ‘Log in|Log Out’ merchandise and click on on the Add to Menu button.
Don’t overlook to click on on the Save Menu button to retailer your modifications. Now you can go to your web site to see your customized login logout hyperlink in motion.

The hyperlink will dynamically change to login or log off relying on a person’s login standing.
Be taught extra in our tutorial on add login and logout hyperlinks in WordPress menus.
2. Add Login / Logout Hyperlinks utilizing Customized Code
This methodology requires you so as to add code to your WordPress web site. Should you haven’t achieved this earlier than, then check out our information on add customized code in WordPress.
First, it is advisable to discover out the title that your WordPress theme makes use of for the particular navigation menu location.
The simplest technique to discover that is by visiting the Look » Menus web page and taking your mouse over to the menu places space.

Proper-click to pick Examine software and you then’ll see the situation title within the supply code beneath. As an illustration, our demo theme makes use of major, footer, and top-bar-menu.
Be aware the title used on your goal location the place you wish to show the login / logout hyperlink.
Subsequent, it is advisable to add the next code to your theme’s features.php file or a site-specific plugin.
1
2
3
4
5
6
7
8
9
10
|
add_filter( 'wp_nav_menu_items' , 'add_loginout_link' , 10, 2 ); perform add_loginout_link( $objects , $args ) { if (is_user_logged_in() && $args ->theme_location == 'major' ) { $objects .= '<li><a href="' . wp_logout_url() . '">Log Out</a></li>' ; } elseif (!is_user_logged_in() && $args ->theme_location == 'major' ) { $objects .= '<li><a href="' . site_url( 'wp-login.php' ) . '">Log In</a></li>' ; } return $objects ; } |
After that, you may go to your web site and also you’ll see the login our log off hyperlink in your navigation menu.

This dynamic hyperlink will robotically change to login or logout primarily based on person’s login standing.
4. Including Customized Textual content to Your WordPress Navigation Menu
What for those who simply wished so as to add textual content and never a hyperlink to your navigation menu?
There are two methods you are able to do that.
1. Add Customized Textual content to a Particular Menu (Straightforward Manner)
Merely go to the Look » Menus web page and add a customized hyperlink with # signal because the URL, and the textual content you wish to show as your Hyperlink Textual content.

Click on on the Add to Menu button to proceed.
WordPress will add your customized textual content as a menu merchandise within the left column. Now, click on to develop it and delete the # signal.

Don’t overlook to click on on the Save Menu button and preview your web site. You’ll discover your customized textual content seem within the navigation menu.
It’s nonetheless a hyperlink, however clicking on it doesn’t do something for the person.

2. Add Customized Textual content to a Navigation Menu Utilizing Code
For this methodology, you’ll add a code snippet to your web site. First, you’ll want to seek out out the title of your theme location as described above within the login/logout hyperlink part.
After that, it is advisable to add the next code to theme’s features.php file or a site-specific plugin.
1
2
3
4
5
6
7
|
add_filter( 'wp_nav_menu_items' , 'your_custom_menu_item' , 10, 2 ); perform your_custom_menu_item ( $objects , $args ) { if ( $args ->theme_location == 'major' ) { $objects .= '<li><a title="">Customized Textual content</a></li>' ; } return $objects ; } |
Merely substitute the place it says ‘Custom Text’ with your personal textual content.
Now you can save your modifications and go to your web site to see your customized textual content added on the finish of your navigation menu.
This code methodology could turn out to be useful if you wish to programmatically add dynamic components to particular WordPress menu.
5. Add Present Date in WordPress Menu
Do you wish to show the present date inside a navigation menu in WordPress? This trick is useful for those who run a continuously up to date weblog or a information web site.
Merely add the next code to your theme’s features.php file or a site-specific plugin.
1
2
3
4
5
6
7
8
9
10
|
add_filter( 'wp_nav_menu_items' , 'add_todaysdate_in_menu' , 10, 2); perform add_todaysdate_in_menu( $objects , $args ) { if ( $args ->theme_location == 'major' ) { $todaysdate = date ( 'l jS F Y' ); $objects .= '<li><a>' . $todaysdate . '</a></li>' ; } return $objects ; } |
Don’t overlook to switch ‘primary’ along with your menu’s location.
Now you can go to your web site to see the present date in your WordPress menu.

You may as well change the date format to your personal liking. See our tutorial on change the date and time format in WordPress.
6. Show Consumer Title in WordPress Menu
Need to add somewhat extra personalization to your navigation menu? You may greet logged in customers by their title in your navigation menu.
First, you’ll want so as to add the next code to your theme’s features.php file or a site-specific plugin.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
add_filter( 'wp_nav_menu_objects' , 'username_in_menu_items' ); perform username_in_menu_items( $menu_items ) { foreach ( $menu_items as $menu_item ) { if ( strpos ( $menu_item ->title, '#profile_name#' ) !== false) { if ( is_user_logged_in() ) { $current_user = wp_get_current_user(); $user_public_name = $current_user ->display_name; $menu_item ->title = str_replace ( "#profile_name#" , " Hey, " . $user_public_name , $menu_item ->title . "!" ); } else { $menu_item ->title = str_replace ( "#profile_name#" , " Welcome!" , $menu_item ->title . "!" ); } } } return $menu_items ; } |
This code first checks in case you have added a menu merchandise with #profile_name# as hyperlink textual content. After that, it replaces that menu merchandise with logged in person’s title or a generic greeting for non-logged in customers.
Subsequent, it is advisable to go to Look » Menus web page and add a brand new customized hyperlink with the #profile_name#
as Hyperlink textual content.

Don’t overlook to click on on Save Menu button to retailer your modifications. After that, you may go to your web site to see the logged-in person’s title within the WordPress menu.

7. Dynamically Show Conditional Menus in WordPress
Thus far we have now proven you add several types of customized objects to particular WordPress menus. Nonetheless, typically you could have to dynamically present completely different menu objects to customers.
As an illustration, you could wish to present a menu solely to logged in customers. One other situation is while you need the menu to alter primarily based on what web page the person is viewing.
This methodology permits you to create a number of menus and solely show them when sure situations are matched.
First, it is advisable to set up and activate the Conditional Menus plugin. For extra particulars, see our step-by-step information on set up a WordPress plugin.
Upon activation, it is advisable to go to Look » Menus web page. From right here it is advisable to create a brand new menu that you just wish to show. As an illustration, on this instance we created a brand new menu for logged in customers solely.

After you have got created the menu, change to the Handle Places tab.
From right here, it is advisable to click on on the Conditional Menus hyperlink subsequent to the menu location.

After that, it is advisable to choose the menu you created earlier from the drop down menu.
Then, click on on the ‘+ Conditions’ button to proceed.

It will carry up a popup window.
From right here, you may choose the situations that should be met with the intention to show this menu.

The plugin affords a bunch of situations to select from. As an illustration you may present the menu primarily based on particular web page, class, publish sort, taxonomy, and extra.
You may as well present completely different menus primarily based on person roles and logged in standing. As an illustration, you may present a special menu to present members on a membership web site.