How i replaced the top searchbar with location/zipcode search field
Hi first just want to say there is propably a much better way of doing this but this is the only way i could come up with and its working perfect for what i need it for. This isnt really a tutorial but i hope it may help somebody looking to do the same thing.
It you go to the site im working on:
www.bikehunt.co.uk (please ignore the domain will be switching soon)
you will see my home search is a location/zipcode field and not the default "ad title" search.
(try searching london or N1)
How i done this was:
first of all i removed everything in theme-searchbar.php and placed this code:
<div class="customsearch">
<?php
cp_show_refine_search('10');
?>
</div>
this will display the "refine results" search used on the search sidebar,
the number "10" is the ad category for the form i want to display.
Now, the refine results is displaying on my homepage instead of the default search.
next i went into: /includes/search.php
i then wrapped each <li> element in a div so for example :
<div class="divnamehere">
<li class="amount">
<label class="title">Budget (per week):</label>
<input type="text" id="amount" name="amount" />
<div id="slider-range"></div>
<label class="title"><?php echo esc_html( __( 'Precise price', APP_TD ) ); ?>:</label><input type="checkbox" id="precise_price" name="precise_price" <?php checked( isset( $_GET['precise_price'] ) ); ?> />
</li>
</div>
and then, i added some css style to remove every <li> element from my homepage refine search form apart from the location/zip code field.
so from the example codes above i would put:
.customsearch .divnamehere li {display:none;}
this way, the refine sidebar will have all my fields as normal but they will not be displayed on my homepage form.
sorry if im not explaining it well but i will answer any questions
on another note, i have made quite a few customizations to my site, if you like any let me know and ill try to help
Regards