Return to Snippet

Revision: 43933
at April 3, 2011 17:58 by alp


Initial Code
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;
}

Initial URL
http://www.wprecipes.com/how-to-automatically-add-a-search-field-to-your-navigation-menu

Initial Description
Place snippet in functions.php

Initial Title
How to automatically add a search field to your navigation menu | Wordpress

Initial Tags
wordpress

Initial Language
PHP