NOTE: There is a better way to do this that I discuss in this tutorial:
http://bavotasan.com/tutorials/adding-a-search-bar-to-the-nav-menu-in-wordpress/
Way back before WordPress 3.0 came out, there was an option to include a search form in the nav menu for most of my themes. I have actually created a function to do this but so far have only included it with the release of Magazine Flow. I will add it to my other themes in their next release, but until then, here is a little tutorial so that you can get the functionality now.
First, open up header.php and add the get_search_form() function right after the call to the main nav menu around line 136:
136 | <?php |
#header { position: relative; } |
This worked great for me using Magazine Premium. I have a question about the text inside the search box. After doing this i went into searchform.php to try to change the text that shows up inside the search box. whenever i changed the text from 'Search & Hit Enter' to anything else, it would change the text, but the text wouldn't disappear when i clicked inside the search box. instead it stayed there and i would have to manually delete those letters. how do i change that text AND have it disappear when i click in the search box?
Worked for me also but I went through the same thing and have exactly the same question as adamhirsch.
Your input tag needs some JavaScript.
<input type="text" class="search_input" value="<?php _e('Search & Hit Enter', "magazine-basic"); ?>" name="s" id="s" onfocus="if (this.value == '<?php _e('Search & Hit Enter', "magazine-basic"); ?>') {this.value = '';}" onblur="if (this.value == '') {this.value = '<?php _e('Search & Hit Enter', "magazine-basic"); ?>';}" /> |
Sorry, I'm confused. Here's what I put in my searchform.php file
<form method="get" id="searchform" action="<?php echo home_url(); ?>/"> |
The apostrophe is giving you some grief. Use this:
<form method="get" id="searchform" action="<?php echo home_url(); ?>/"> |
I have performed the steps above. How do I get the same magnifying glass to show in the search box as you show at the top of this page?
Where can I get that image so I can add it to my images folder? Can you be more specific about the CSS to add?
You do show this effect in your demo so we would expect to be able to reproduce it.
Thank you.
You can add the magnifying glass by changing the link in the custom CSS from
url(images/search.png)
to
url(wp-content/themes/magazine-premium/images/search.png)
Take a look around, and if you would like to add a comment or start a discussion, register by clicking on the button below.
RegisterCopyright © 2012 bavotasan.com. All Rights Reserved. Powered by Vanilla.