Hiding posts from certain categories on index page
-
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <!-- If the post is in the category we want to exclude, we simply pass to the next post. --> <?php if (in_category('1')) continue; ?>
I’ve tried this, but it shows no posts from any categories, just a link to page 2. On page 2 it shows 1 post and links to next previous pages. Page 3 shows 2 posts and links to next previous pages. Pages 4 and 5 are blank like Page 1 (index page).
I also tried
<?php if (is_home()) { query_posts("cat=-1"); } ?>
Which works, BUT the links to previous pages show exactly the same posts as page 1 (index page). An example of this can be seen on my site, plantedbox.com.
How can I hide posts from Cat 1 (Latest News) but keep all other functions, like next and previous pages?
Many thanks,
– James
https://www.plantedbox.com
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Hiding posts from certain categories on index page’ is closed to new replies.