Created
May 5, 2012 18:07
-
-
Save thefrosty/2604443 to your computer and use it in GitHub Desktop.
Custom query to grab posts from the same day..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); |
I believe 'month' has to be 'monthnum'
http://codex.wordpress.org/Class_Reference/WP_Query under Time Parameters
Ah crap, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This query is grabbing posts from each day. When I want it to just query the posts from the posts date.