Results 1 to 1 of 1

Thread: How i replaced the top searchbar with location/zipcode search field

  1. #1
    Thread Starter
    petfive's Avatar
    Join Date
    Jun 2013
    Location
    London, UK
    Posts
    95
    Thanks
    3
    Thanked 12 Times in 11 Posts

    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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [MOD NEEDED] Location Search - How to add a field
    By localarchitect in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: December 15th, 2013, 03:20 AM
  2. Location theme-searchbar.php file
    By collectorsloft in forum Vantage General Discussion (Legacy)
    Replies: 2
    Last Post: October 2nd, 2012, 06:22 PM
  3. Is there a widget to search ads by zipcode?
    By loomis96 in forum Report ClassiPress Bugs
    Replies: 4
    Last Post: September 13th, 2012, 06:30 PM
  4. Zipcode field - #$^&*
    By espinosae in forum ClassiPress General Discussion
    Replies: 1
    Last Post: February 1st, 2011, 03:52 AM