Skip to content

Instantly share code, notes, and snippets.

@thefrosty
Created May 5, 2012 18:07
Show Gist options
  • Save thefrosty/2604443 to your computer and use it in GitHub Desktop.
Save thefrosty/2604443 to your computer and use it in GitHub Desktop.
Custom query to grab posts from the same day..
global $post;
$args = array(
'post__not_in' => array( $post->ID ),
'posts_per_page'=> -1,
'day' => get_the_time( 'd', $post->ID ),
'month' => get_the_time( 'm', $post->ID ),
'year' => get_the_time( 'Y', $post->ID ),
);
$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
endwhile;
endif;
// Reset Post Data
wp_reset_postdata();
// Reset Query
wp_reset_query();
@thefrosty
Copy link
Author

Ah crap, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment