WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Excluding a category from monthly/daily archives (3 posts)

  1. pauljohns
    Member
    Posted 8 years ago #

    I am in the process of making my girlfriend a web site @ http://www.amandajeankelly.com.
    Using <?php query_posts('cat=-2'); ?> in my archives page, I am able to exclude category 2 (books) from my yearly archives with no problems, see http://www.amandajeankelly.com/2006.

    This code however, creates another issue. On the monthly archives page (May, for example: http://www.amandajeankelly.com/2006/05) the posts are displayed the same as if they were on the yearly archives page, with other months' posts showing up as well. Same for daily archives page.

    Can someone tell me a better way to exclude category 2 from all of my archives page, or point me to a good plugin that does the job?

    Thanks!

  2. moshu
    Member
    Posted 8 years ago #

    Just a guess. With the query_posts you over-ride the default Loop in the archive.php and I assume you are using (better to say: WP is using) the same template file to display any kind of archives... it will always show you tha same.

    Possible workaround:
    http://codex.wordpress.org/Theme_Development#Theme_Template_Files_List
    See the date.php and archive.php - though that might not be enough.
    You can also take a look at the deafult theme's archive.php file to see how it uses a bunch of if_statements; maybe that will give you a start.

  3. pauljohns
    Member
    Posted 8 years ago #

    That sounds like good advice, but I decided to go another route (mostly to make it easier): just use different display info for the category I was previously trying to exclude. Later, though, i might go back and change that. thanks Moshu.

Topic Closed

This topic has been closed to new replies.

About this Topic