Created
April 24, 2012 16:17
-
-
Save baczoni/2481130 to your computer and use it in GitHub Desktop.
Wordpress: Add searchbox to nav menu
This file contains hidden or 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', 10, 2); | |
function add_search_box($items, $args) { | |
ob_start(); | |
get_search_form(); | |
$searchform = ob_get_contents(); | |
ob_end_clean(); | |
$items .= '<li>' . $searchform . '</li>'; | |
return $items; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment