Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i tried this code, it is not giving me any 404 page instead it is giving me the same page back, now i think the submit buttons needs to be configured

function the_taxonomy_dropdown($taxonomy) {
  $id = "{$taxonomy}-dropdown";
  $terms = get_terms($taxonomy);
  echo "<select name=\"{$id}\" id=\"{$id}\">";
  foreach($terms as $term) {
    echo '<option value="';
    echo get_term_link(intval($term->term_id),$taxonomy);
    echo '">' . "{$term->name}</option>";
  }
  echo "</select>";
}
add_action('init','jquery_init');
function jquery_init() {
  wp_enqueue_script('jquery');
}

this code was provided to me by one of the person from this website, i just modified it, this works but its just showing me the home page again

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Just a standard HTML form will do!

<form action="<?php echo home_url('/'); ?>" method="get">

    <p><?php wp_dropdown_categories('taxonomy=taxonomy-1&name=taxonomy-1'); ?></p>
    <p><?php wp_dropdown_categories('taxonomy=taxonomy-2&name=taxonomy-2'); ?></p>
    <p><input type="submit" value="Search!" /></p>

</form>

Just replace taxonomy-1 and taxonomy-2 with the names of your taxonomies.

Important

If you registered your taxonomy with a custom query_var, you'll need to match it in the name argument of wp_dropdown_categories().

Also, querying multiple taxonomies is not supported as of 3.02 - you'll need the 3.1 beta, a plugin or additional filters.

share|improve this answer
    
i tried this but it is giving me 404 error for every search –  ntechi Dec 10 '10 at 13:36
1  
Did you install the plugin or additional filters as indicated? As has been said, multiple taxonomy queries are not supported "as is".. –  t31os Dec 10 '10 at 14:57
    
i am using GDCPT plugin for custom taxonomies, just that i am using for for custom taxonomies –  ntechi Dec 10 '10 at 17:18
    
Could you post a link to the plugin? –  TheDeadMedic Dec 10 '10 at 18:26
    
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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