MENU

Fetch All-in-One Event Calendar data in a loop

It is a method to retrieve the information of each event by looping the event information of “All-in-One Event Calendar”.

We have confirmed the operation with the latest version 2.6.8 at the time of writing.

I picked up mainly the ones that I could use.
There are other data that can be retrieved.

$args = array(
	'post_type' => 'ai1ec_event'
);

$wp_query = new WP_Query( $args );

global $ai1ec_registry;

while ( $wp_query->have_posts() ) :

	$wp_query->the_post();

	$event = new Ai1ec_Event( $ai1ec_registry );
	$event->initialize_from_id( $post->ID );

	$event_title = $event->get( 'post' )->post_title;//event name
	$event_slug = $event->get( 'post' )->post_name;//Slug
	$event_content = $event->get( 'post' )->post_content;//Article content
	$event_allday = $event->get( 'allday' );//All-day event
	$event_instant_event = $event->get( 'instant_event' );//No end time
	$event_start = $event->get( 'start' )->format('Y-m-d' );//Start date
	$event_end = $event->get( 'end' )->format('Y-m-d' );//End date
	$event_venue = $event->get( 'venue' );//Venue
	$event_address = $event->get( 'address' );//Address
	$event_longitude = $event->get( 'longitude' );//Longitude
	$event_latitude = $event->get( 'latitude' );//Latitude
	$event_contact_name = $event->get( 'contact_name' );//Contact name
	$event_contact_phone = $event->get( 'contact_phone' );//Contact phone number
	$event_contact_email = $event->get( 'contact_email' );//Contact email address
	$event_contact_url = $event->get( 'contact_url' );//Contact URL
	$event_cost = $event->get( 'cost' );//Participation fee
	$event_is_free = $event->get( 'is_free' );//Free event
	$event_ticket_url = $event->get( 'ticket_url' );//Ticket URL

endwhile;

wp_reset_postdata();
Let's share this post !
  • Copied the URL !
  • Copied the URL !

Author of this article

Comments

List of comments (1)

To comment

TOC