Quantcast
Viewing all articles
Browse latest Browse all 134490

artman1988 on "CSS styling for search menu added to nav menu"

Hi,
In my twenty twelve theme I added the search form to my nav menu by adding the code below to my functions.php file:

// add search to menu bar
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();

	if( $args->theme_location == 'primary' )
        return $items .= '<li>' . $searchform . '</li>';

    return $items;
}

You can see the site here: website

What I want to do is modify the search form with css styling - mainly having the menu aligned to the right of the nav menu.
I am not sure what ID to use for the css styling. Or should I create a new css class? If so, what do I name it

My first guess was to use an ID of "searchform", but that didn't work so well.

Thanks for your help.


Viewing all articles
Browse latest Browse all 134490

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>