Skip to content

Hide certain categories from displaying on your homepage in Wordpress

Updates

2010-09-03 00:27
2010-09-02 18:48
2010-09-03 00:14
2010-09-03 00:14
2010-09-03 00:05
2010-09-03 00:05
2010-09-02 23:54
2010-08-30 14:25
2010-09-02 23:10
2009-12-01 18:23
Monday, October 27, 2008 - 23:43
>First of all you need to find this piece of code in your theme, either in home.php or index.php
<?php while (have_posts()) : the_post(); ?>
Then you need to insert this piece of code directly below it
<?php if (in_category('235') && is_home()) continue; ?>
But you need to replace 235 with your category you want to exclude. You can find the category by going to manage-categories, then you need the ID of the category. Now that's how you exclude a category from the homepage in Wordpress.

Comments

March 31, 2009

by Rafal (not verified), 1 year 22 weeks ago

Hey, thanks! I was looking for such a solution for some time now.

It seems that one needs to use "&&" instead of "$$" to make it work. I'm not into PHP at all though.

BTW. Wprecipes' post is about excluding categories from RSS feed, not the main page.

March 31, 2009

by evl (not verified), 1 year 22 weeks ago

Thanks, I have fixes this now.

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <ul> <ol> <li> <dl> <dt> <dd> <a> <p> <span> <div> <h1> <h2> <h3> <h4> <h5> <h6> <img> <map> <area> <hr> <br> <br /> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <em> <b> <u> <i> <strong> <font> <del> <ins> <sub> <sup> <quote> <blockquote> <pre> <address> <cite> <param> <strike> <caption>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
2 + 13 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.