Created
March 28, 2017 10:46
-
-
Save unaibamir/ccc59b6002533061ebee4f3dbe606d73 to your computer and use it in GitHub Desktop.
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
$day_next = new DateTime('+1 day'); | |
$date = $day_next->format('Y-m-d H:i:s'); | |
$args = array( | |
'post_type' => 'page', | |
'post_status' => 'publish', | |
'meta_query' => array( | |
array( | |
'key' => 'live_session_end_time', | |
'value' => $date, | |
'compare' => '<', | |
'type' => 'DATETIME' | |
) | |
) | |
); | |
$the_query = new WP_Query( $args ); | |
// The Loop | |
if ( $the_query->have_posts() ) { | |
echo '<ul>'; | |
while ( $the_query->have_posts() ) { | |
$the_query->the_post(); | |
echo '<li>' . get_the_title() . '</li>'; | |
} | |
echo '</ul>'; | |
/* Restore original Post Data */ | |
wp_reset_postdata(); | |
} else { | |
// no posts found | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment