You are here:  » Search Bar in Header


Search Bar in Header

Submitted by fstore on Fri, 2012-09-21 07:49 in

Hi David
Firstly many thanks for all your help, you have been very kind.

I have couple of question...

For my Test site, I have setup a search bar in the header of the wordpress template by using the following html code:
I wanted to get a search bar next to logo in the header.
{link saved}

This setup is causing two issues for me:
1- Search keywork is not retained in the search bar once land on search result page, (for example: If search a keywork "camera" from home page, which will land on search page,search bar gets empty.
How can I keep the keywork, which was search from home page in the search bar?

2- Two search bars on the search page. because i am using the shortcode [pto] for page "/shopping" I find two search bars on search page, one from header, and send from [pto]. How can I remove the search bar from [pto]?

<div id="searchContainer">
<form method="GET" action="http://108.59.253.71/~fstorec1/zeesht/shopping">
<input type="search" result="5" name="pto_q" id="field" />
<input type="submit" name="submit" id="submit" value="Search" />
<br><div class="search_info">Searching over 4,333,563 products...</div>
</form>
</div>

Thanks in advance

Kind Regards

Submitted by support on Fri, 2012-09-21 08:59

Hello Hassan,

Thank you for your comments!

To populate the serch box in the header with the current query; first try the following in place of your input type="search" line:

 <input type="search" result="5" name="pto_q" value="<?php print (isset($_GET["pto_q"])?htmlentities($_GET["pto_q"],ENT_QUOTES):""); ?>" id="field" />

This will be dependent on the above code being included at a point at which PHP tags will be processed - if that turns out not to be the case we can look at other options.

With the search box in your header working, to remove the [pto] generated search box simply delete the contents of the HTML > Main / Search Form template in wp-admin > Settings > PriceTapestry.org and that will do the trick...

Cheers,
David.
--
PriceTapestry.com