Creating a custom category teplate that lists child categories
-
Hi, I’m hoping that someone can help.
I have 5 parent categories for which I want to create separate category templates. On each template I want to list each post (title only) under it’s repective child category heading.
This is what I used (which obviously doesn’t work):
[please use the code button to mark any code – http://codex.wordpress.org/Forum_Welcome#Posting_Code ]
<div id="archive_list"> <h3>Grocery Savings</h3> <?php get_posts('category=87'); ?> <?php while (have_posts()): the_post(); ?> <li><a href="”<?php">”><?php the_title(); ?></a></li> <?php endwhile; ?> </div>
Category ID 87 is the child category ID. I use this code for each child category.
Looks great, but is just listing the wrong things – it lists all the posts in the parent category without sorting as per child category.
Here’s what I’m aiming for: http://frugalandthriving.com.au/category/food-and-groceries/
Is it at all possible to create a custom list of links for just the posts in the child category?
My level of PHP is minimal at best, but I’m willing to learn :).
Thanks for any help in advance.
- The topic ‘Creating a custom category teplate that lists child categories’ is closed to new replies.