WordPress.org

Forums

Exclude Category from Homepage (8 posts)

  1. theicast
    Member
    Posted 7 years ago #

    Anyone know a good plugin that will allow you to exclude certain categories or posts from showing on the main page? I have many posts that I only want to have shown in the category pages and archives.

    Needs to work with WP 2.5.

    Thanks!

  2. zombiechan
    Member
    Posted 7 years ago #

    I would like this same plugin. Any guidance would be much appreciated!

  3. Joni
    Member
    Posted 7 years ago #

    Some category plugins will do this. You'll need to go here:
    http://wordpress.org/extend/plugins
    and browse the plugin repository. There's one specific plugin, called Category Overload, that seems very powerful, but I have yet to get it to work on any of my WP blogs. Once it's activated, it throws out blank pages.

    You can also play around with the query posts function of WP to specify only a certain category of posts to appear on the front page. Read about that here: http://codex.wordpress.org/Template_Tags/query_posts

  4. zombiechan
    Member
    Posted 7 years ago #

    Category Overload hasn't been tested on 2.5 by the author, but it seems worth a shot.

    I tried the template tag. But no luck.

    EDIT: I tried the Category Overload plugin, but then it said I had no categories.

  5. Joni
    Member
    Posted 7 years ago #

    And you DO in fact have categories? Found this article, might help also:
    http://bvphotography.ca/2008/04/30/using-query_posts/

  6. zombiechan
    Member
    Posted 7 years ago #

    I got it to work through WordPress's theme editor.
    It didn't work when I added it to the index.php file though.

    Either way it's working now. :)

  7. Joni
    Member
    Posted 7 years ago #

    Category Overload? How did you manage that?

  8. Ashton.Sanders
    Member
    Posted 6 years ago #

    The Answer is on this page:
    http://codex.wordpress.org/Template_Tags/query_posts

    Here's the quote:

    Exclude Categories From Your Home Page

    Placing this code in your index.php file will cause your home page to display posts from all categories except category ID 3.

    <?php
    if (is_home()) {
    query_posts("cat=-3");
    }
    ?>

    You can also add some more categories to the exclude-list(tested with WP 2.1.2):

    <?php
    if (is_home()) {
    query_posts("cat=-1,-2,-3");
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic