diff --git a/src/wp-admin/includes/class-wp-community-events.php b/src/wp-admin/includes/class-wp-community-events.php
index 79c4a85adb..b9262f2134 100644
a
|
b
|
class WP_Community_Events { |
416 | 416 | } |
417 | 417 | |
418 | 418 | /** |
419 | | * Discards expired events, and reduces the remaining list. |
| 419 | * Trims events list to prepare it for presentation. |
420 | 420 | * |
| 421 | * Discards expired events, forces first WordCamp to appear first |
| 422 | * and reduces the remaining list. |
| 423 | * |
| 424 | * @access protected |
421 | 425 | * @since 4.8.0 |
422 | 426 | * |
423 | 427 | * @param array $response_body The response body which contains the events. |
… |
… |
class WP_Community_Events { |
427 | 431 | if ( isset( $response_body['events'] ) ) { |
428 | 432 | $current_timestamp = current_time( 'timestamp' ); |
429 | 433 | |
| 434 | $wordcamps = array(); |
430 | 435 | foreach ( $response_body['events'] as $key => $event ) { |
| 436 | if ( empty( $wordcamps ) ) { |
| 437 | if ( 'wordcamp' === $event['type'] ) { |
| 438 | array_push( $wordcamps, $event ); |
| 439 | unset( $response_body['events'][ $key ] ); |
| 440 | } |
| 441 | } |
431 | 442 | // Skip WordCamps, because they might be multi-day events. |
432 | 443 | if ( 'meetup' !== $event['type'] ) { |
433 | 444 | continue; |
… |
… |
class WP_Community_Events { |
440 | 451 | } |
441 | 452 | } |
442 | 453 | |
| 454 | $response_body['events'] = array_merge( $wordcamps, $response_body['events'] ); |
| 455 | |
443 | 456 | $response_body['events'] = array_slice( $response_body['events'], 0, 3 ); |
444 | 457 | } |
445 | 458 | |