Forums

Possible to exclude certain years of posts with wp_get_archives sidebar list? (2 posts)

  1. smallwebsolutions
    Member
    Posted 1 year ago #

    I have a client that would like to have two sets of archive drop-down lists on her sidebar. One would be for posts ranging from 2002 to 2006 and another would be for her latest posts from 2006 on.

    Is it possible to exclude certain years of posts using the wp_get_archives function?

    I know there are several plugins out there that I could use that archive categories (which we could categorize posts by the year they were published), but the one I am using now is having a pagination conflict with wp-pagenavi, which is part of the theme we are using. I'd like to hardcode the archive php call directly into the sidebar, which seems to solve the conflict.

    Thanks in advance for any help you might be able to provide.

  2. smallwebsolutions
    Member
    Posted 1 year ago #

    Found the solution to this issue and am posting the fix here in case anyone else runs into this. The problem was that the permalink rewrite in the WP Category Archives plugin was placing the category before the date, when the category should appear after the date, i.e. http://mysite.com/2010/11/general/page/2.

    For yearly archiving, at line 56 change:

    $year_month_path = $year . "/00";

    to

    $year_month_path = $year . "/";

    For monthly archiving, at line 70 change:

    $url .= $category . "/" . $year_month_path . "/";

    to

    $url .= $year_month_path . "/" . $category . "/";

Topic Closed

This topic has been closed to new replies.

About this Topic