grouping posts under same categories on homepage
-
Hi ,
I am trying to show posts grouped under categories in index.php with no success .What i am trying to do :
———————————–
Parent Category Name
-
5 Post titles in this category
————————————
Parent Category Name 2
-
5 Post titles in this category2
————————————
for all parent categories.One option that i found is this ;
`<div>
<p>cat1</p>
<?php $my_query = new WP_Query( ‘category_name=cat1&posts_per_page=7’ );
while ( $my_query->have_posts() ) : $my_query->the_post();
$do_not_duplicate = $post->ID; ?>
<h3 ><a href=”<?php the_permalink(); ?>”><?php the_title();?></a></h3>
<?php endwhile; ?>
</div>But if i use this then i will have to repeat same code for all categories and then also for child categories in category template.
. I am stuck in this .
Help would be really really appreciated .
- The topic ‘grouping posts under same categories on homepage’ is closed to new replies.