Is there any way to keep the search terms in the search bar after the searcher has pressed "enter"? Like how in Google or YouTube the search terms still appear in the bar on the results page.
Is there any way to keep the search terms in the search bar after the searcher has pressed "enter"? Like how in Google or YouTube the search terms still appear in the bar on the results page.
<input id="s" type="text" size="15" name="s" value="<?php the_search_query(); ?>" />
Thank you t31os_, that solution almost works. Currently I have:
value="Search Posts, Tags and Categories"
Although your code:
value="<?php the_search_query(); ?>"
keeps the search query in the search field it also gets rid of "Search Posts, Tags and Categories".
I wanted that to be in the search field at first and only after the user enters the new search I wanted it to display the search query. Is that possible?
Inside the value...
<?php if(is_search()) { the_search_query(); } else { ?>Search Posts, Tags and Categories<?php } ?>
Does that help? :)
It sure does, that you so much t310s_ your solutions have helped me a lot over the past few weeks!
You're welcome.... :)
This topic has been closed to new replies.