WP Add Search Icon to end navigation

<?php /* * Search Icon In Menun ********************************************************************** */ add_filter('wp_nav_menu_items','side_menu_function', 10, 2); function side_menu_function( $nav, $args ) { if( $args->menu_class == 'nav-menu' ) //insert navigation class to target return $nav."<li class='search'><a href='javascript:;'><i class='fa fa-search'></i></a></li>"; return $nav; } ?>
This example is using Font Awesome search icon.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.