WordPress.org

Ready to get started?Download WordPress

Forums

exclude single category from monthly archives (10 posts)

  1. katie1
    Member
    Posted 8 years ago #

    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
    <ul>
    <?php get_archives('monthly','','','<li>','</li>',''); ?>
    </ul>
    <?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

    Kate

  2. katie1
    Member
    Posted 8 years ago #

    "Bump"

    Can someone please help me with this issue?

    thank you

  3. katie1
    Member
    Posted 8 years ago #

    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: http://www.gudlyf.com/archives/2005/03/08/wordpress-plugin-category-visibility

    enjoy

  4. katie1
    Member
    Posted 8 years ago #

    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.

  5. moshu
    Member
    Posted 8 years ago #

  6. katie1
    Member
    Posted 8 years ago #

    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".

  7. moshu
    Member
    Posted 8 years ago #

    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.

  8. katie1
    Member
    Posted 8 years ago #

    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?

    Kate

  9. goblue
    Member
    Posted 7 years ago #

    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.

  10. goblue
    Member
    Posted 7 years ago #

    I think I found the answer in this thread.

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags