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.

Sorry if this is a silly question but is it possible to have a taglist as a dropdown?

I have a page where users can post theyre own content, and I would like them to be able to choose certain tags as a dropdown, is this possible?

Heres the page so you can see http://wordpress.art-williams.com/add-destination

I appreciate any help what so ever, anything is a huge help!

Thanks

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can use wp_dropdown_categories() to create your dropdown:

wp_dropdown_categories(array('taxonomy'=> 'post_tag','hide_empty' => 0, 'name' => 'my_tags'));

Update

the reason you are getting the term ID is because wp_dropdown_categories sets the ID's as values so instead of just echo'ing it out you need to get the term, something like:

$term = get_term_by('id',$your_id,'post_tag');
echo $term->name;
share|improve this answer
    
Oh wow you are a genius! :) Thank you, if I wanted to exclude a tag from that list, would I just need to put in 'exclude=ID' ? –  Art Aug 16 '11 at 14:19
    
@art: yep just add exclude with id to the array. –  Bainternet Aug 16 '11 at 14:25
    
Ok sorry i have tried this wp_dropdown_categories(array('taxonomy'=> 'post_tag','exclude=6', 'hide_empty' => 0, 'name' => 'my_tags')); and it isnt working –  Art Aug 16 '11 at 14:29
    
because its wrong syntax, change`'exclude=6'` to 'exclude'=>6 –  Bainternet Aug 16 '11 at 14:51
    
Brilliant, thank you very much. Appreciate it. –  Art Aug 16 '11 at 14:54

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.