I have been looking for hours for an example on how to do this. I have 2 simple taxonomies, Type, Size. I need to create a custom form with the 2 taxonomies available as Select list/filter.

Please help!

tx in advance

<form role="search" method="get" id="searchform" action="<?php bloginfo('home'); ?>">
            <input type="text" value="" name="s" id="s" /> 

        function get_terms_dropdown($taxonomies, $selectname,$args){
            $myterms = get_terms($taxonomies, $args);
            $selected = "selected";
            $output ="<select name='".$selectname."'><option selected='".$selected."'>Select</option>'";

            foreach($myterms as $term){
                $term_name =$term->name;
                $output .="<option value='".$term_slug."'>".$term_name."</option>";
            $output .="</select>";
        return $output;

        $taxonomies = array('location');
        $taxonomies2 = array('function');
        $taxonomies3 = array('sector');
        $args = array('order'=>'ASC','hide_empty'=>false);
        echo "<br />".get_terms_dropdown($taxonomies,'location' ,$args)."<br />";
        echo get_terms_dropdown($taxonomies2,'function' ,$args)."<br />";
        echo get_terms_dropdown($taxonomies3, 'sector' ,$args)."<br />";
        <input type="submit" id="searchsubmit" value="Search" />
  • Can you clarify where you need help? In creating the form to integrate with WordPress, in querying the database, or something else? – MikeSchinkel Feb 4 '11 at 14:58
  • Hi Mike, I will need help in creating the correct form, with the right query to pull the taxonomy in select list and then be able to search the DB using these taxonomies as filters. Makes more sense? – salocin Feb 4 '11 at 15:46
  • ok, getting somehwere, thx for the scribu plugin, but doesnt seem to work for me. Reading some comments, I found this code which I have adapted. This is getting my taxonomies correctly in select list, but how do i pass the value to the search $_post or $_get. Search is working by picking up the value of s, the text input, but not the select list. see my code below – salocin Feb 4 '11 at 16:07
  • updated my code above. Input text is "searched", I need some help to include the terms from the 3 custom list (taxonomies). thx in advance – salocin Feb 4 '11 at 17:27

take a look at scribu Query Multiple Taxonomies plugin it creates a drill-down navigation widget

| improve this answer | |

I think <?php bloginfo('home'); ?> on the first line should change with <?php bloginfo('url'); ?>. I tried like that and it works.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.