WordPress categories can be displayed in a drop down using wp_dropdown_categories. The categories can be displayed in hierarchy which shows the parent and child categories. Dynamic child categories can be displayed using Ajax.

The WordPress Category Dropdown plugin gives this functionality. The plugin gives you a shortcode that will let you display all the categories in a dropdown. You can select the parent category and the child categories for that parent will be displayed in another dropdown.

This feature will come in handy when you want to give your users an option to navigate easily through the number of categories you have on your site. You can also set the shortcode to display categories from a custom post type.

The one thing the plugin does not yet do is to differentiate between the categories that do and do not have child categories. I am working on that feature as well and it should be available soon.

Currently, you can use ‘include” to display only the categories with children. If you only have a few categories without children, you can use “exclude” to hide these categories from the dropdown.

The plugin can be downloaded from GitHub – https://github.com/cguntur/wp-category-dropdown/blob/master/wp-category-dropdown.php

Here is a quick demo of the how the plugin works.

Leave a Reply

%d bloggers like this: