How can I include/exclude a specific category from being displayed on the homepage?
In some cases, you may want the "river" of stories on your site's homepage to either be limited to a particular category (or categories) OR to show all posts except those in a particular category or categories.
We have a way to explicitly include/exclude in the Largo Theme Options.
- First, find the category ID for the category you'd like to include/exclude in question.
- Go to Posts > Categories and click on the category as though you were going to edit it
- The URL will be something like "http://.../wp-admin/edit-tags.php?action=edit&taxonomy=category&tag_ID=62&post_type=post"
- The tag ID is the number you want. It's 62 in this example
- Once you have that ID, go to Appearance > Theme Options and choose the Layout tab
- Scroll down to the section labeled Other Homepage Display Options
- To exclude the category in this example, put "-62" in the box in front of Categories to include or exclude
- A minus directly in front of the tag ID (without a space) will exclude that category
- The number without the minus will limit the loop to just that category
- You can add more categories to include or exclude by separating them with a comma. It is also possible to mix included/excluded categories. For example "4,-17,37" would show posts in categories with the IDs of 4 and 37 that are NOT also in the category with ID 17).
Further Reading:
For more information on how this works, see the
WordPress codex entry on limiting a query by category