I have found a way to show all posts from the current year with this code:
<?php $today = getdate(); $lastyear = $today[ 'year' ]; $args = array( //'nopaging' => true, 'paged' => $paged, 'category' => 1, 'posts_per_page' => 36, 'year' => $lastyear, ); query_posts( $args ); // The Query ?> <div id="grid"> <?php while ( have_posts() ) : the_post(); // The Loop ?> <?php get_template_part( 'article', 'thumb' ); ?> <?php endwhile; ?> </div> <?php get_template_part( 'navigation' ); ?> <?php wp_reset_query(); // Reset Query ?>
However, what I really want is to show posts from 2 years ago till today (it's Jan 2014), meaning, posts from 2012 and 2013 and 2014. How do I do this?
Many thanks in advance.