Multiple Category Drop Down Boxes to Search Posts (13 posts)

  1. ImagineDesignEx
    Posted 6 years ago #

    I'm working on a project that has a listing of workshops. Categories in this case might include things like the artist giving the workshop, the location, the year, the topic, and etc.

    What I'm trying to do is put together a series of drop down boxes that will allow you to filter the posts: Artist #1 is giving a workshop in 2010 in Arizona, for example.

    I've found the multiple-category-selection-widget which is PERFECT for this, but it seems to be broken in WordPress 2.8.4.

    I've tried doing custom search forms that have the drop down boxes, but when the search query comes up, we have a format like this: /?s=&cat=13,17 - This query brings up all posts in categories 13 and 17, not just the posts that are in BOTH 13 and 17.

    Does anyone have a method or any advice on what to do about this problem? I need something that will let me do the search based on posts that are ONLY IN the selected categories, not ALL the posts that are in ALL the selected categories.

    I've seen a lot of other people trying to do this, but I haven't really seen a solution other than the multiple-category-selection-widget (again, its broken). Some of the other advanced category or search plugins say they'll do something like this, but I've not found anything that's quite right.


  2. mediabros
    Posted 6 years ago #

    i would love to see this issue solved!

  3. petezarustica
    Posted 6 years ago #

    Me too.

  4. soulgeek
    Posted 6 years ago #

    Shame no solution Still!!!!

    Am sure there are solutions for this, will anyone help us out?

  5. Shane G.
    Posted 6 years ago #


    Refer this article:



    Shane G.

  6. bn07.bn07
    Posted 6 years ago #

    I too have the same problem. Pls help if u got the solution.

  7. noelgreen
    Posted 6 years ago #

    Yep... I just posted about this.

    Any luck?

  8. takien
    Posted 6 years ago #

    my idea is like this:
    get category id from $_GET method.. yoursite.com/?s=some+term&cat=2,
    it's assumed will only search "some term" only in category 2...

    please customize your own search form using wp_dropdown_categories().. it's pretty simple i think...

    then you have to make a function something like my_search_filter();

    function my_search_filter() {
    $thecat = $_GET['cat'];
    $where = "AND post_category = $thecat";
    return $where;
    if(is_search()) {

    place that code in your functions.php inside current theme directory...

  9. noelgreen
    Posted 6 years ago #

    Thanks man!

    I updated my function.php, but what does the actual search button look like... or the drop downs menus?

    Here's my search box / button...

    <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
    <input type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s"/>
    <input type="hidden" name="cat" value="16" />
    <input type="submit" id="searchsubmit" value="Search" /><br />

    And here's one of my drop downs...

    php wp_dropdown_categories('depth=0&child_of=22&orderby=name&hide_empty=0&show_option_all=Any');

    Can you post a full working multiple drop down example?????

  10. noelgreen
    Posted 6 years ago #

    Here's an example of a site that does pretty much exactly what I want... though I don't think they're really using a "search" feature...


  11. takien
    Posted 6 years ago #

    Hi.. i just write a simple plugins to do that..
    You don't need to edit any files. Just install and go..


    gorillathemes.com is using custom field... not just the category.

  12. castmir
    Posted 5 years ago #

    gorillathemes.com is using Categories!!, no custom field.

  13. vtxyzzy
    Posted 5 years ago #

    I just downloaded and installed Multiple Category Selection Widget in my 2.8.6 test bed, and it works.

    You need to be sure that you have Parent/Child categories set up or it doesn't select anything. I tried it with this structure:

    - Dayton
    - Columbus
    - Monroe

    - Hotels
    - Motels

    - Museums
    - Parks

Topic Closed

This topic has been closed to new replies.

About this Topic