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 want to let the users search posts by categories. So I use wp_dropdown_categories to build a drop-donw list with all categories. Trouble is I want to allow them to set this to "ALL CATEGORIES" as well. So how can I add another entry in the drop-down list? Thanks,

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

Should be easy to do
(check the codex: wp dropdown categories)

<h2><?php _e('Categories:'); ?></h2>
<div>
    <?php wp_dropdown_categories('show_option_all=ALL CATEGORIES&show_count=1&hierarchical=1'); ?>
</div>

p.s
if you want to wrap with translation this is the way:

<h2><?php _e('Categories:'); ?></h2>
<div>
    <?php wp_dropdown_categories('show_option_all='.__('All Categories', 'your_text_domain').'&show_count=1&hierarchical=1'); ?>
</div>
share|improve this answer
add comment

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.