Developers are able to access MegaCalendar information for use in custom built theme templates.
MegaCalendar Functions
For more information about available functions see Template Functions and Instance Methods
// Get the MegaCal plugin instance $megacalblock = MegabaseCalendar::get_instance(); //Event functions: get_title() get_image_url() get_event_date() get_start_time() get_end_time() get_description() get_organizer() get_private_note() get_facebook_url() get_ticket_url() get_price_details() get_published() get_created_by_me() //Is it mine or not //Objects (Needs extra functions): get_tagged_users() get_owner() get_event_category() //Venue: $venue = $event->get_venue(); $venue->get_id(); $venue->get_name(); $venue->get_location(); //get permalink: $event_detail_path = $megacalblock->get_event_detail_url();
MegaCalendar Template Usage
This example shows how to display MegaCalendar Events as a List from your theme template files.
<?php $events = $megacalblock->megacal_get_public_events( array( 'upcoming' => true, 'max_result' => 4, )); ?> <?php foreach( $events as $event ) { ?> <?php $event_date = $event->get_event_date(); ?> <a class="eventBox boxWrap" href="<?php echo site_url( trailingslashit( $event_detail_path ) . $event->get_id() ); ?>"> <!-- If a Poster or Event Thumbnail Exists --> <?php if( !empty( $event->get_image_url() ) ): ?> <?php $thumbnail_src = $event->get_image_url(); ?> <img src="<?php echo esc_url( $thumbnail_src ); ?>" class="eventImg imgShadow alignleft" alt="<?php esc_attr_e( $event->get_title() ); ?>" /> <?php else: ?> <div> <img src="<?php echo esc_url( megacal_get_default_event_image_path(), array( 'http', 'https' ) ); ?>" class="eventDefault artistReplace alignleft defaultPic" /> </div> <?php endif; ?> <div class="text"> <p class="date" title="<?php echo date('D M d, Y', strtotime( $event_date )); ?>"><?php echo date('l n/j/y', strtotime( $event_date )); ?></p> <p class="name"><?php esc_html_e( $event->get_title() ); ?></p> </div> </a> <?php } ?>