Forums

[resolved] wp_get_archives but skip the current year (4 posts)

  1. mrmist
    Member
    Posted 10 months ago #

    I have a widget for my sidebar that displays the last year's worth of archives as a monthly list. That works great.

    BUT I would like then to list previous years as a yearly list, but skip out the current year.

    Is there a way to do this?

    For clarity, I have a list that does this -

    Jan 2009

    I'd want another list that does this

    2008
    2007

    Etc.. missing out 2009.

  2. mrmist
    Member
    Posted 10 months ago #

    Ahh, easier than I thought. I just needed to add a filter

    $sql=$sql . ' AND YEAR(post_date) < YEAR (CURRENT_DATE) ';

    to getarchives_where

  3. chocks
    Member
    Posted 6 months ago #

    Hi! I'm looking exactly for that solution! Would you mind sharing with me the code to do that please?
    I'd like to get the archives by year (skiping the actual) and list monthly the current years' archive.

    Cheers,

    J.-

  4. stope
    Member
    Posted 6 months ago #

    Hi there, I'm not good with PHP and MySQL (shame on me) so I'm asking you for help - in my wp_get_archives I need to skip first six months listed. Can it be done by modyfiing your code posted here? Thx...

Reply

You must log in to post.

About this Topic