how to create a menu with all sub categories?

This depends on what kind of menu you are talking about:

1)

If you are talking about “custom menus” (found in the Backend under Design -> Menus) you can do the following:

  • Create a new function with the action hook add_category

  • inside of this function, you can create a new post of type the menu
    item type, which is added correctly to your menu

  • whenever a new category is published the menu item is added now

  • you should also hook into delete category, to keep your menu
    up-to-date

2)

You could do much easier without a wordpress menu:

  • just write a function to list your categories (or use the predefined
    wp_list_categories function)
  • if this is not sufficient write a customized one which (maybe
    recursivley) reads your categories from the database

For option 1 to code you require some knowledge about WordPress though.

Leave a Comment