WordPress.org

Support

Support » How-To and Troubleshooting » Listing posts in groups

Listing posts in groups

  • On my archive pages I need to list the content in category groups. In order to do that I use “rewind_posts();” and run multiple loops like the one below.


    while (have_posts()) : the_post();
    if (in_category('8')) {
    include "includes/post.php";
    }
    endwhile;

    Now, when there is no content in that category it is an empty space. And if I do an else statement in my if(in_category(‘8’)) conditional I get as many lines as there are total posts.

    Is there a way for me to say, if there are no posts in a category, to display a message?

    Example

  • The topic ‘Listing posts in groups’ is closed to new replies.