WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple Category Search (9 posts)

  1. joshrodgers
    Member
    Posted 1 year ago #

    I'm trying to create a search feature that will allow users to enter a search term and select a couple of categories. The script searches a single category just fine, but when I add more than one I hit a roadblock.

    My code is as follows:

    http://pastebin.com/SQiCHNu5

    As I was searching around I discovered: WordPress Multiple Category Search, which seems to do exactly what I want...however I'm not sure how to incorporate the suggestion.

    I'm pretty sure you add the following to your functions file:

    http://pastebin.com/iHCu0iQJ

    But, how do I incorporate this into the search form? I'm sure it's something simple, but I'm lost...anyone have any ideas?

    Thanks, Josh

  2. joshrodgers
    Member
    Posted 1 year ago #

    Ok,

    I found something I think is going to work, it just needs a small tweak...

    While searching, I found the following plugin: Query Multiple Taxonomies

    All I have to do is activate the plugin and add the following code to my template: http://pastebin.com/w4zANRBc.

    This works...you can check it out at: http://www.joshrodgers.com/.

    The only thing is, is that the dropdown has both the make and the model, is there any way to restrict it so that the first one just has "Make" and the second just has "Model"?

    NOTE: I created my own template for the dropdown (Reference Here) which looks like: http://pastebin.com/hLN16JF9.

    Thanks in advance!
    Josh

  3. joshrodgers
    Member
    Posted 1 year ago #

    I think I can make my original code work...When I do a search with the plugin the url is: http://joshrodgers.com/?s=title&product_cat=saturn&product_cat=view

    I just changed the names of the dropdowns to match and now My code now looks like:

    http://pastebin.com/4N2n6WFf

    When I do a search the only difference between my code and theirs is that theirs uses names for the product_cat, where mine uses numbers...is there anyway to change this so that mine also uses names?

  4. joshrodgers
    Member
    Posted 1 year ago #

    Found a solution!!

    This goes into your functions file: http://pastebin.com/UHHR5pPb.

    This goes into your theme: http://pastebin.com/9GqbFDZx.

    The walker provides the functionality :)

    Hope this helps someone!!!!

    Thanks,
    Josh

  5. joshrodgers
    Member
    Posted 1 year ago #

    Ok...after all that I discovered I still had a problem with my search...

    I have fixed the problem and the solution looks like this:

    My functions page now looks like: http://pastebin.com/dZ4S6XbG
    My form now looks like: http://pastebin.com/y5WiaT6y
    My search page now looks like: http://pastebin.com/1bnPb2Xu

    Hope this helps someone :)

  6. Clayton WPcom
    Member
    Posted 1 year ago #

    GREAT!!!
    Thanks a lot to put the solved problem!

    I had the same issue and I haven't found until now!

    Gold medal!

  7. Clayton WPcom
    Member
    Posted 1 year ago #

    Ahh, and I married in oct,27 2007. Great day too!

  8. dvinedno
    Member
    Posted 1 year ago #

    Hi,

    I have been looking for a feature like this for ages... I followed your steps but dont seem to get it working.

    Ive added your FORM into searchform.php

    and added the:

    <?php get_search_form(); ?>

    On my search.php page

    I added the coding to the functions.php

    But im wondering where you place this code?

    My search page now looks like: http://pastebin.com/1bnPb2Xu

    The feature Im looking for is to be able to search text or if none selected to search between multiple category's via location and job type.

  9. dvinedno
    Member
    Posted 1 year ago #

    The plugin for multiple category selection works but you cannot search text.

Topic Closed

This topic has been closed to new replies.

About this Topic