WordPress: Excluding Categories on Secondary Front Pages

More precisely, this tutorial covers how to exclude categories on paged front pages, index.php, beyond the first default listing.

Excluding certain categories from the front page is a pretty easy task, just use the query_posts() function to remove those categories before going into the loop, like so:

[php][/php]

But if the visitor tries to see the next set of posts through “Older Entries,” the same results are queried. Instead, use this:

[php][/php]

We can tell query_posts() which set of posts to display with the paged parameter and the $paged variable, a WordPress variable which returns the current page number (1 for the first, 2 for the second, and so on).

One Response to WordPress: Excluding Categories on Secondary Front Pages

  1. Pingback: The Best Of WordPress Snippets - Part 1 - JustWP.org

Leave a Reply

Your email address will not be published.