Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: multiple drop-down search form using custom fields and custom taxonomies [part 2]

  1. #1
    Thread Starter
    Amateur davidhaz's Avatar
    Join Date
    Mar 2011
    Posts
    12
    Thanks
    0
    Thanked 8 Times in 6 Posts

    multiple drop-down search form using custom fields and custom taxonomies [part 2]

    ///////////////////////////////////////////////////////////////

    now we need to place the drop-down box where it belongs. so, open the theme-searchbar.php located in themes -> classipress -> includes - theme-searchbar.php . This is where the original search form is located. what we wanna do is replace this form with our new one, built upon our custom drop-down boxes. so, locate this piece of code :

    <?php wp_dropdown_categories('show_option_all='.__('All Categories', 'appthemes').'&hierarchical='.get_option('cp_cat_h ierarchy').'&hide_empty='.get_option('cp_cat_hide_ empty').'&depth='.get_option('cp_search_depth').'& show_count='.get_option('cp_cat_child_count').'&or derby='.get_option('cp_cat_orderby').'&title_li=&u se_desc_for_title=1&tab_index=2&class=searchbar&ta xonomy=ad_cat'); ?>

    and you replace it with this one:

    <?php my_dropdown_categories('name=Location&taxonomy=ad_ location&hierarchical='.get_option('cp_cat_hierarc hy').'&hide_empty=1&depth='.get_option('cp_search_ depth').'&show_count='.get_option('cp_cat_child_co unt').'&orderby='.get_option('cp_cat_orderby').'&t itle_li=&use_desc_for_title=1&tab_index=1&class=se archbar&show_option_all='.__('All locations','appthemes').'&show_option_none='.__('C hoose a location','appthemes').'&selected=-1'); ?>

    what we did here is replace the initial drop-down box built upon appthemes' function with a new one using our tweaked version of appthemes' function ( the my_dropdown_categories function ). notice the 'name' and 'taxonomy' parameters in this new function: they should hold your own custom values (Location and ad_location in this instance). the 'hide_empty' parameter sets whether the drop-down box should not display empty categories (1 being the equivalent of 'yes' and 0 being 'no').
    to have multiple drop-down boxes all you need to do is paste in the above code snippet as many times as you'd like to have drop-down boxes, making sure to change the name and taxonomy parameters to fit the specific taxonomy you want to be displayed in the drop-down box.
    now let's style this up! this is where the 'name' parameter plays its role since it will be used as the identifier of the styling class to be used for the corresponding drop-down box. paste the following css code anywhere in your style.css (preferably at the bottom):

    .form_search select#Location.searchbar{float:right; border:1px solid #BBB; min-height:15px; min-width:70px; padding:7px;font-size:17px;color:#666666;-khtml-border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; border-radius: 6px; line-height: 33px;}

    you should have noticed the "select#Location" part, where we link this styling rule to the specific drop-down box with the same name 'Location' (these names are case-sensitive).
    at this point you should have a drop-down box filled with the values of your custom field 'location', styled just like the 'original' categories drop-down and holding the 'terms' of your 'ad_location' taxonomy (that is the terms that have been used in any given ad posting).

    ///////////////////////////////////////////////////////////////////////////////////////////

  2. The Following 3 Users Say Thank You to davidhaz For This Useful Post:

    davidcvd (June 7th, 2011), einstein (December 18th, 2011), waylandltd (June 2nd, 2011)

  3. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,973
    Thanks
    169
    Thanked 3,406 Times in 3,277 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  4. #3
    Rookie davidcvd's Avatar
    Join Date
    May 2011
    Posts
    5
    Thanks
    3
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Junior Member michel's Avatar
    Join Date
    May 2011
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #5
    Rookie davidcvd's Avatar
    Join Date
    May 2011
    Posts
    5
    Thanks
    3
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. The Following User Says Thank You to davidcvd For This Useful Post:

    infinity (August 3rd, 2011)

  8. #6
    Newbie infinity's Avatar
    Join Date
    Jul 2011
    Location
    Italy
    Posts
    1
    Thanks
    1
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    Newbie eyesx's Avatar
    Join Date
    Jul 2011
    Location
    Sweden
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    Junior Member swapmama's Avatar
    Join Date
    Aug 2011
    Location
    Algeria
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. #9
    Junior Member swapmama's Avatar
    Join Date
    Aug 2011
    Location
    Algeria
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  12. #10
    Junior Member swapmama's Avatar
    Join Date
    Aug 2011
    Location
    Algeria
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [TUTORIAL] multiple drop-down search form using custom fields and custom taxonomies [part 1]
    By davidhaz in forum ClassiPress General Discussion
    Replies: 6
    Last Post: June 6th, 2011, 06:40 AM
  2. [TUTORIAL] Part ONE -- changing the way Custom Fields are named 3.05.1
    By vienna in forum ClassiPress General Discussion
    Replies: 2
    Last Post: November 23rd, 2010, 04:00 PM
  3. Custom Taxonomies and custom post types in Classipress
    By carlos takemura in forum ClassiPress General Discussion
    Replies: 1
    Last Post: July 8th, 2010, 04:26 PM