Skip to content

Instantly share code, notes, and snippets.

@unaibamir
Created March 28, 2017 10:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unaibamir/ccc59b6002533061ebee4f3dbe606d73 to your computer and use it in GitHub Desktop.
Save unaibamir/ccc59b6002533061ebee4f3dbe606d73 to your computer and use it in GitHub Desktop.
$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