Support » Fixing WordPress » exclude single category from monthly archives

  • Can someone please advise what additional code I’ll require to exclude category 20 & sub-cats from my monthly archives?

    This is the code in my sidebar template:

    <?php if (!is_page("archives")) { ?>
    <p class=”subheading”>archives
    <?php get_archives('monthly','','','<li>','</li>',''); ?>
    <?php } ?>

    This is the php code in the BX_Function (Blix)
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>

    When I click on November 2005 in the archives, I don’t want the posts in category 20 or its sub-cats to be visible in the archives only.

    Thanks guys & gals, I really appreciate your help


Viewing 9 replies - 1 through 9 (of 9 total)
  • “Bump”

    Can someone please help me with this issue?

    thank you

    OK. Here is an update for those also struggling with this.

    I used the very clever Category Visibility Plugin by Gudlyf to effectively remove specific categories from my archives.

    If you’re going to use this plugin – which is easy to use – when you download it you have to change the extension from phps to php before FTPing. Then, under Admin/Manage (obviously after actiating the plugin 🙂 )you’ll find another section called Category Visibility, which you can then pre-set which categories you want to show on your Front Page, Lists, RSS, Archives, User Levels, etc via checkboxes. Pretty simple, huh?

    Link to plugin page URL:


    OK – small glitch.

    When I check box “archives” to hide a specific category, it removes the category completely from the site.

    I’ve checked with the author’s comments, and it seems to be a persistent bug. I guess I’m back to the drawing board…

    ho hum.

    Ok. thanks Moshu – the plugin looked promising but for some reason I can’t click “Save” to save my new settings in my admin/manage/(in)visibility…

    Have you encountered this problem? I’ve uploaded thrice, and still no ability to “save”.

    Sorry, I can’t really remember. I don’t use it (I am on the minimalist extreme when it comes to plugins) but I know I installed it for a client a few months ago. Can’t recall anything like that. Later we decided not to use it because basically all they needed was only to exclude some categories from the frontpage, and Ryan Boren’s front-page-cat plugin was much much lighter on db queries than these two above.

    Thanks for the reply. I’ll hit google again, to see if there is a way around this.

    I’m a little stunned that the ability to omit a category from the archives and yet still allow the category to show in its natural category place is leading to this drama.

    Perhaps the developers can look into this some time in the future?


    katie1 – Were you able to figure this dilemma out? I’m having the same issue. I just want to exclude 1 category from the monthly archives (or ANY archives for that matter), but using query_posts doesn’t seem to work for me on an archive page. Works fine on the homepage, but query_posts seems to break my archive page.

    I think I found the answer in this thread.

    The answer looks similar to:
    $wp_query->set('cat','-3'); query_posts('');

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘exclude single category from monthly archives’ is closed to new replies.