I'm trying to make a WordPress blog where in the index page only Parents Categories appear. In second page need to appear SubCategories and hide posts, if not exists SubCategories show posts for the Parent Category.
I would use a combination of get_categories and get_category_children to achieve this. For example:
On the home page include something like this:
And then on the sub category page:
[I haven't tested this but its the way I have done it previously - obviously you'll need to change a few bits and pieces. Make sure to read the function docs do you dont just end up frustrated!]
You will need to have your categories and 'the loop' set up properly for this to work [get_the_category(); for example must be called from within the loop unless a category ID is supplied].
Make sure to read the docs on all the functions used to understand what they're doing: get_category_children - http://hitchhackerguide.com/2011/02/12/get_category_children/ get_categories - http://codex.wordpress.org/Function_Reference/get_categories get_posts - http://codex.wordpress.org/Template_Tags/get_posts
Comment if you have troubles and I'll do my best to elaborate further.