Commit fcb57bc8 authored by Erick Hitter's avatar Erick Hitter
Browse files

Review feedback: reduce chance loop will be needed

parent a4b9aee7
......@@ -146,16 +146,14 @@ class Internal_Events extends Singleton {
global $wpdb;
$page = 1;
$quantity = 25;
$quantity = 100;
do {
$offset = max( 0, $page - 1 ) * $quantity;
$query = $wpdb->prepare( "SELECT ID, post_date FROM {$wpdb->posts} WHERE post_status = 'future' AND post_date > %s LIMIT %d,%d", current_time( 'mysql', false ), $offset, $quantity );
$future_posts = $wpdb->get_results( $query );
if ( empty( $future_posts ) ) {
break;
} else {
if ( ! empty( $future_posts ) ) {
foreach ( $future_posts as $future_post ) {
$future_post->ID = absint( $future_post->ID );
$gmt_time = strtotime( get_gmt_from_date( $future_post->post_date ) . ' GMT' );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment