Forums

Removing categories from archive (3 posts)

  1. cjkorf
    Member
    Posted 4 years ago #

    Ok, I figured out how to remove two categories from my index page by placing this in index.php:

    <?php
    if (is_home()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=-4,-5&paged=$paged");
    }
    ?>

    That keeps categories 4 & 5 from showing. My next question is how can I do the same thing on my archive page.

    I've got a custom archive.php and I tried calling it like:

    <?php
    if (is_archive()) {
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts("cat=-4,-5&paged=$paged");
    }
    ?>

    This excluded the 4 & 5 categories, but it shows all the post no matter what month or archives I went to. Anybody, know what I can do to make this happen?

  2. moshu
    Member
    Posted 4 years ago #

    Don't sweat it...
    Scroll uip > Extend > Plugins and search until you find this:
    http://wordpress.org/extend/plugins/advanced-category-excluder/

  3. cjkorf
    Member
    Posted 4 years ago #

    Thanks, that was simple enough.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.