MEC_HELPERS::get_events( $is_from_endpoint = false )

Returns the list of events registered in MEC.


Return Return

(array) The list of events.


Source Source

File: src/integrations/modern-events-calendar/helpers/mec-helpers.php

	public function get_events( $is_from_endpoint = false ) {



		$args = array(
			'post_type'      => 'mec-events',
			'posts_per_page' => 99,
			'orderby'        => 'title',
			'order'          => 'ASC',
			'post_status'    => array( 'publish', 'private' ),
		);

		$events = array();

		$options = Automator()->helpers->recipe->options->wp_query( $args, false, null );

		$events = array();

		foreach ( $options as $value => $text ) {
			$events[] = array(
				'value' => $value,
				'text'  => $text,
			);
		}

		if ( $is_from_endpoint ) {
			return $events;
		}

		return $options;
	}