Hello folks, I hope you can help me with a small issue.
I want to be able to access a customised category page (which I’ve set up, e.g.: ‘Campaigns’) and then list:
A sub-category header (eg: ‘Neighbourhood watch’)
Its description (eg: ‘This is a campaign to get people…’)
Posts filed in that sub-header.
And loop this for all the sub-categories.
Right now I’m using this piece of code:
<li><a href="<?php echo get_category_link(75);?>"><b><?php echo category_description(75); ?></b></a> Posts on this campaign:<br/> <? global $post; $myposts = get_posts('category=75'); foreach($myposts as $post) : setup_postdata($post); ?> - <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br/> <?php endforeach; ?><br/></li>
But then I have to manually do this for each sub-category without it doing so in a loop.
Can anyone suggest an alternative?
thanks in advance!
- The topic ‘Listing sub-categories and descriptions automatically’ is closed to new replies.