• I’m trying to figure out a way to group my posts by categories. So far I have a page that displays about 14 posts, ordered by category, ascending. I want to display the category title for each category group, so basically separate them with a title.

    I want to be able to accomplish this within my current code, here is a sample:

    query_posts('showposts=' . $limit . '&cat='.$blogCategoryIdStr . '&orderby=category');
    if(have_posts()) { ?>
     <?php while(have_posts()) { ?>
    
    <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?> </a></h3>
    <p><?php the_content ?></p>
    
    <?php } } ?>

    This is a simplified version of my code but hope it makes sense.

Viewing 1 replies (of 1 total)
  • Thread Starter get_all_oranges

    (@get_all_oranges)

    just to clarify, since I think my initial post can be confusing, the code i have and provided here does sort my posts by category ascending and they display all together in that order. what i need to accomplish is display the title for each category so i can create a category header for better visuals.

Viewing 1 replies (of 1 total)
  • The topic ‘list posts by category inside the loop’ is closed to new replies.