Sub-category which shows posts list of parent category
-
Don’t ask me why but I have this need on my site:
I have the following category structure which is also reflected in the menu:
cat 1 (parent)
cat 2 (sub)
cat 3 (sub)
cat 4 (sub)
cat 5 (sub)Every link of the menu redirect to the relative page of the category which show the posts list.
I need ‘cat 2’ to show not only posts of ‘cat 2’ but ALL the posts of the sub-categories of ‘cat 1’ (therefore cat 2,3,4 and 5)
I made the query using tag is_category but I get errors like “syntax error, unexpected ‘)'” and so on. This is the query I used:
<?php if (is_category('magazine')) { query_posts('cat=61'); ?> <?php } elseif ()) { ?> <?php global $query_string; query_posts($query_string); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php } else { ?><?php } ?>
Anyone has an idea on how to write a query for my needs?
(A sub-category which shows the posts list of ALL the posts belonging to the parent category)Thanks in advance…
- The topic ‘Sub-category which shows posts list of parent category’ is closed to new replies.