0

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,

1 Answer 1

3

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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