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.

Similiar to category drop down box for a list of terms with the same parent, I want to make such a drop down for a list of tags with the same group name( or some other conditions that works). Seems WP doesn't provide a way to use term group, any other way to make the drop down ?

share|improve this question
1  
If your terms are grouped they are hierarchical. So use a hierarchical taxonomy instead. –  toscho Jan 6 '12 at 2:01
    
Thanks! Seems have to use category. –  Jenny Jan 6 '12 at 4:06
1  
The term_group is used internally for term aliasing, you shouldn't really try to override it with anything. –  Otto Sep 11 '12 at 20:07

1 Answer 1

The examples i quote in my answer can be found here, i also recommend you read that page carefully to help you with this.

But lets grab an existing example there and change it a bit.

<?php

//you must change the parameters in the get_terms function to get exactly the terms you want
$terms = get_terms("my_taxonomy");
$count = count($terms);
if ( $count > 0 ){

    //the onchange value allows you to go to the term page when you select it, if you dont want that, remove it and remove the value in the options too
    echo '<select onchange="document.location.href=this.options[this.selectedIndex].value;">';
    foreach ( $terms as $term ) {
      echo '<option value="'.get_term_link($term->slug, 'CHANGE-THIS-TO-YOUR-TAXONOMY-NAME').'">' . $term->name . '</option>';
    }
    echo "</select>";
}

//more on the get_term_link function here: http://codex.wordpress.org/Function_Reference/get_term_link

?>

I hope this answers your question.

share|improve this answer

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.