Created
March 31, 2017 13:30
-
-
Save tanatip/ee65203a1b7a57e55f9699072d14c733 to your computer and use it in GitHub Desktop.
Add search box to menu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wp_nav_menu_items','add_search_box_to_menu', 10, 2); | |
function add_search_box_to_menu( $items, $args ) { | |
if( $args->theme_location == 'primary' ) | |
//return $items."<li class='menu-header-search'><form class='searchform' action=''><input type='text' value='' class='search-box' name='s' id='s' placeholder='' /><i class='icon-search'></i></form></li>"; | |
return $items."<li class='menu-header-search'><form class='searchform' action=''><i class='icon-search'></i></form></li>"; | |
return $items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment