Support » Plugins » Hiding posts in 2.0

  • Hi. I’m upgrading to 2.0 and can’t seem to find a way to hide posts from one category on the main page. Any ideas? Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • In your main page index.php, ther is a loop for presenting your latest posts. It starts something like this:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    Immediately below that line, if you put this condition:

    <?php if ( !(in_category('4')) || !is_home() ) { ?>

    you will exclude posts from category number 4 form sjowing up on the main page.

    What it says is:
    If it is not from category 4 or if it is not on the main page, display it.

    ( is_home = true for the main page )

    Hi. I’ve tried that and I get a parse error on that line. Is there another way to do this?

    Did you close the if-statement with <?php }; ?> ?

    Why don’t you just use the private feature on the post/edit page?

    It’s not so easy to just copy and paste code from the forum, and each theme may use the loop a little differently.

    A full explanation of the method I tried to introduce can be found in The Loop, here.

    Good luck!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Hiding posts in 2.0’ is closed to new replies.