我在回答中引用的例子可以找到here, 我还建议你仔细阅读这一页,以帮助你做到这一点。
但是,让我们抓住一个现有的例子并稍作修改。
<?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
?>
我希望这能回答你的问题。