Include specific category children in index.php loop
-
Hey guys!
Here’s what I want to do. In the Index.php page, I’d like the following logic to be carried out:
If have posts…while have posts…
PRINT EXCERPT OF CATEGORY 1 (and child cats in cat1)
PRINT EXCERPT OF CATEGORY 2 (and child cats in cat2)
PRINT EXCERPT OF CATEGORY 3 (and child cats in cat3)
endwhile;
Print navigation
Else:
No posts found.
endif;I’m stuck on the print part, I can do everything else. I don’t want the loop to print cat 1 and 2 and 3, I want it to print cat 1, then cat2, then cat 3, including the children cats of each parent category called. I’m styling differently and need the output of each cat grouped neatly together so my page flows properly.
Codex only talks about excluding categories…thats really hard to work with in my case because I’d like to call a specific category, I’m pretty sure there’s a way to do it, through a count increment or something? I read the multi-loop page in codex but it feels like what I’m trying to do can’t be done. My programing skills are so-so, I can’t really write code, I can follow its logic though….so any thoughts? Can it be done?
(This is not a static Page, its my Index.php page)
- The topic ‘Include specific category children in index.php loop’ is closed to new replies.