apply_filters( 'wp_nav_menu_items', string $items , stdClass $args )
Filters the HTML list content for navigation menus.
Description Description
See also See also
Parameters Parameters
- $items
-
(string) The HTML list content for the menu items.
- $args
-
(stdClass) An object containing wp_nav_menu() arguments.
Source Source
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Add HTML5 search form to a menu
Add this code to functions.php. You can completely modify the output, and style the form as you want.
Please, don’t forget to replace the theme_location !
For example, if the id of my menu was main-menu, I would write
if( $args->theme_location == 'main-menu' )
Hope this will help.
Expand full source codeCollapse full source code
Add extra menu item to a WordPress Nav Menu
Using this code snippet, one can add an additional menu item to the end of a WordPress navigation menu. For example, here in this case I am adding a WooCommerce Login/Register link when a user is not logged in, and a My Account page link when a user is logged in.
How to use the above code?
Hope this helps someone :)