Specific category on index.php but empty on other categories
-
For my index.php i only just wanna show a few categories from my usual line-up of posts. I am using other categories to put posts as well, but i only wanna show three categories on the normal index.php.
To show those I am using the following code:
<?php $posts=query_posts($query_string . '&posts_per_page=5'); ?> <?php if(have_posts()) { while ( have_posts() ) : the_post(); if(in_category('film') || in_category('wip') || in_category('forum')) { ?> // Loop-y-loop stuff <?php }; endwhile; } else { echo 'Sorry, no updates yet.'; } ?>
Now the issue here is that even though it’s showing just those categories I have selected it is still showing 4 posts on the every page. Meaning, in between there’s another post that’s not in the specified categories, but it’s still taking up a place in the
posts_per_page
string.How can I solve this issue so the index.php will still be showing 5 posts per page, ignoring any other posts that are not in the specified categories?
- The topic ‘Specific category on index.php but empty on other categories’ is closed to new replies.