• Hi,
    I want to modify the archive widget code to have archive since a given date on. I see that parameters of “wp_get_archives” only give “limit” as an option. Is there a workaround? I’d like to display monthly archive from january 2008 to present (updated ).

    Thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi,

    You can do that by adding the following code to the functions.php file of your theme:

    function getarchives_since($string){
    	return $string . " AND post_date > '2008-01-01 00:00:00'";
    }
    add_filter('getarchives_where', 'getarchives_since');

    However, that will make your Archives page also show the archives since January 2008.

    Thread Starter wouq

    (@wouq)

    It works like a charm, thanks for your time!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Archive only since a given date’ is closed to new replies.