WordPress.org

Ready to get started?Download WordPress

Forums

Exclude Category From Archives (4 posts)

  1. monkeynotes
    Member
    Posted 9 years ago #

    Hi, I know this has been asked before, but I have not found an answer. How can I exclude a certain category from showing up in an archives page?

    Ideally I want to split my archives into category based archives, an archive that lists posts for one category and another list that shows posts for another category. Something similar to the archives found on kottke.org

    http://www.kottke.org/everfresh

    This is useful for separating remainder links and various other types of posts from the main archive lump.

  2. Kafkaesqui

    Posted 9 years ago #

    All depends on how you generate your category links. If you're using either list_cats() or wp_list_cats() to do it, see the info on the 'exclude' parameter:

    http://codex.wordpress.org/Template_Tags/list_cats#Parameters
    http://codex.wordpress.org/Template_Tags/wp_list_cats#Parameters

  3. monkeynotes
    Member
    Posted 9 years ago #

    Sorry, I am not being quite clear here. I don't want to list the actual category names, I want to list the posts, sorted by date (with month headers) in a certain category, excluding the posts in another.

    I know you can use

    <?php if (in_category(n)) { ?> or <?php if (!(in_category(n))) { ?>

    For loop operations but that method does not seem to help when building an archive style page:

    March (20)
    February (10)

    The number is the number of posts in that month, but I don't want to count certain posts such as my remainder link posts.

  4. zemble
    Member
    Posted 9 years ago #

    I'm searching for a solution to the same/similar problem. I want to exclude all but one particular category from a list of archives. (Alternatively, I want to have a list of a single category formated in the same way as wp_get_archives so that I have June 2005 (12), May 2005 (12), etc, but only one category displays. There seems to be numerous requests about this but I can't find the answer. Can it really not be done?

Topic Closed

This topic has been closed to new replies.

About this Topic