\WP_Stager_Integration\Event::get_all_events(bool $include_past = true, int $limit = -1): array[]

Description

Gets all events.

When $include_past is false, only returns upcoming events.

Parameters:

ParameterTypeDescription
$include_past bool (Optional) Whether to include past events as well. Default value: true, include past events.
$limit int (Optional) The maximum number of events to return. -1 for no limit. Default value: -1, return an unlimited amount of events.

Returns:

array[] List of raw Stager event arrays.

Information

Fileclass-event.php line 643

Full Code

/**
 * Gets all events.
 *
 * When $include_past is false, only returns upcoming events.
 *
 * @param bool $include_past (Optional) Whether to include past events as well. Default value: true, include past events.
 * @param int  $limit        (Optional) The maximum number of events to return. -1 for no limit. Default value: -1, return an unlimited amount of events.
 *
 * @return array[] List of raw Stager event arrays.
 */
public static function get_all_events( $include_past = true, $limit = -1 ) {

    // Type casting
    $include_past = (bool) $include_past;
    $limit        = (int) $limit;

    // If past events should be excluded, start from today; otherwise no lower bound
    $start = $include_past ? 1 : Calendar::calculate_timestamp_day_start( time() );

    return self::get_events_within_date_range( $start, null, $limit );
}

💡 If you ever get stuck or have a question, please check our FAQs, our Free Integration Service, our paid Full Integration Service, or reach out to us!

Get WP Stager Integration

🎁 Limited offer: Use code WELCOME26 to get your first month for free!