All in One Calendar Plugin Custom Post Type Query

Hi I'm trying to write a query which will pull the events out from the All in One Calendar Plugin. This is what I have so far:

?php  query_posts('post_type=ai1ec_event');?
?php while ( have_posts() ) : the_post(); ?
?php echo 'h5a href="'.get_permalink().'"'.get_the_title().'/a/h5'; ?
?php endwhile; ?!--  End the Loop --

This works well to get the event titles and their respective content, but I need to get the event details out as well. eg. event dates, venue, location.

Thanks

Topic plugin-events-calendar calendar query Wordpress

Category Web


date is in UNIX format. So I convert it:

$eventdate = $event->start; 
$mydate = date('M d, Y', $eventdate);
echo $mydate

Long time I'm can't get the post content and find a solution:

$text = $event->post->post_content;
echo $text;

perhaps useful to someone


Ok so hope this helps someone. Unless you want to query the database directly, the trick is to include the following:

$event = Ai1ec_Events_Helper::get_event($post->ID);

thereafter you can retrieve the variables, for example:

            <?php  query_posts('post_type=ai1ec_event');?>

            <?php while ( have_posts() ) : the_post(); ?>

            <?php $event = Ai1ec_Events_Helper::get_event($post->ID); ?>

            <?php echo '<h5><a href="'.get_permalink().'">'.get_the_title().'</a></h5>'; ?>

            <?php if( $event->multiday ) echo 'ai1ec-multiday' ?> <?php if( $event->allday ) echo 'ai1ec-allday' ?>

            <?php echo esc_html( $event->start_time ) ?>

            <?php echo $event->timespan_html ?>

            <?php echo $event->venue; ?>

            <?php if( $recurrence ): ?>
            <?php echo $recurrence ?>
            <?php endif ?>

            <?php if( $event->cost ): ?>
            <?php echo esc_html( $event->cost ) ?>
            <?php endif ?>

            <?php if( $contact ): ?>
            <?php echo $contact ?>
            <?php endif ?>

            <?php if( $categories ): ?>
            <?php echo $categories ?>
            <?php endif ?>

            <?php if( $tags ): ?>
                <?php echo $tags ?>
            <?php endif ?>

            <?php endwhile; ?><!--  End the Loop -->

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.