Sub Categories in drop down menu

I have lot of categories and sub categories. I want to add all these in WordPress menu. But i want to add subcategories aligned properly under their parent categories without drag and drop each and every time.
Right now when i select all menus from categories these does not aligned under their parent category.Is there any automated way to do this so it will save my lot of my time?
Your help will be much appreciated.

Topic categories menus plugins Wordpress

Category Web


You can use this function:

the_widget( 'WP_Widget_Categories', 'dropdown=1&hierarchical=1' );

This function give you a select box and you will get all the parent categories and sub-categories. After applying this code inspect category select box, then you can manipulate your HTML code. And show your category as you wish.

If you don't want any select box, then you just remove "downdown=1&". This will give you a whole list of all categories and sub-categories. After applying this code inspect category select box, then you can manipulate your HTML code. And show your category as you wish.

Hope this will help!

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.