* console.log('Event title is: ' + obj.title); * * }); * * }); * * })(window, document, jQuery); * */ ?> <div id="tribe-events-event-<?php echo esc_attr($event_id); ?> " class="<?php tribe_events_event_classes(); ?> " data-tribejson='<?php echo esc_attr(tribe_events_template_data($post)); ?> '> <h3 class="tribe-events-month-event-title"><a href="<?php echo esc_url($link); ?> " class="url"><?php echo $title; ?> </a></h3> </div><!-- #tribe-events-event-# -->
/** * Returns json for javascript templating functions throughout the plugin. * * @category Events * * @param $event * @param $additional * * @return string */ function tribe_events_template_data($event, array $additional = null) { $has_image = false; $image_src = ''; $image_tool_src = ''; $date_display = ''; //Disable recurring event info in tooltip if (class_exists('Tribe__Events__Pro__Main')) { $ecp = Tribe__Events__Pro__Main::instance(); $ecp->disable_recurring_info_tooltip(); $date_display = strip_tags(tribe_events_event_schedule_details($event)); // Re-enable recurring event info $ecp->enable_recurring_info_tooltip(); } else { $date_display = strip_tags(tribe_events_event_schedule_details($event)); } if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) { $has_image = true; $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium'); $image_src = $image_arr[0]; } if ($has_image) { $image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75)); $image_tool_src = $image_tool_arr[0]; } if (has_excerpt($event->ID)) { $excerpt = $event->post_excerpt; } else { $excerpt = $event->post_content; } $excerpt = Tribe__Events__Main::instance()->truncate($excerpt, 30); $category_classes = tribe_events_event_classes($event->ID, false); $json = array('eventId' => $event->ID, 'title' => $event->post_title, 'permalink' => tribe_get_event_link($event->ID), 'imageSrc' => $image_src, 'dateDisplay' => $date_display, 'imageTooltipSrc' => $image_tool_src, 'excerpt' => $excerpt, 'categoryClasses' => $category_classes); /** * Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect * these vars and will break without them, so they are being kept temporarily for * backwards compatibility purposes. * * @todo consider removing in 4.0 */ $json['startTime'] = tribe_get_start_date($event); $json['endTime'] = tribe_get_end_date($event); if ($additional) { $json = array_merge((array) $json, (array) $additional); } $json = apply_filters('tribe_events_template_data_array', $json, $event, $additional); $json = tribe_prepare_for_json_deep($json); return json_encode($json); }
<div class="col-xs-12"> <h5><?php echo trim($current_timeslot); ?> </h5> </div> <?php } ?> <!-- event --> <div id="post-<?php the_ID(); ?> " class="<?php tribe_events_event_classes($class); ?> "> <?php tribe_get_template_part('day/single', 'event-2'); ?> </div> <!-- .hentry .event --> <?php do_action('tribe_events_inside_after_loop'); ?> <?php } ?>
/** * Returns json for javascript templating functions throughout the plugin. * * @category Events * * @param $event * @param $additional * * @return string */ function tribe_events_template_data($event = null, array $additional = null) { // Base JSON variable $json = array('i18n' => array()); if (!is_null($event)) { $event = get_post($event); // Check if we are dealing with an Event if (is_object($event) && $event instanceof WP_Post && tribe_is_event($event->ID)) { $has_image = false; $image_src = ''; $image_tool_src = ''; $date_display = ''; //Disable recurring event info in tooltip if (class_exists('Tribe__Events__Pro__Main')) { $ecp = Tribe__Events__Pro__Main::instance(); $ecp->disable_recurring_info_tooltip(); $date_display = strip_tags(tribe_events_event_schedule_details($event)); // Re-enable recurring event info $ecp->enable_recurring_info_tooltip(); } else { $date_display = strip_tags(tribe_events_event_schedule_details($event)); } if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) { $has_image = true; $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium'); $image_src = $image_arr[0]; } if ($has_image) { $image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75)); $image_tool_src = $image_tool_arr[0]; } if (has_excerpt($event->ID)) { $excerpt = $event->post_excerpt; } else { $excerpt = $event->post_content; } $excerpt = Tribe__Events__Main::instance()->truncate($excerpt, 30); $category_classes = tribe_events_event_classes($event->ID, false); $json['eventId'] = $event->ID; $json['title'] = $event->post_title; $json['permalink'] = tribe_get_event_link($event->ID); $json['imageSrc'] = $image_src; $json['dateDisplay'] = $date_display; $json['imageTooltipSrc'] = $image_tool_src; $json['excerpt'] = $excerpt; $json['categoryClasses'] = $category_classes; /** * Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect * these vars and will break without them, so they are being kept temporarily for * backwards compatibility purposes. * * @todo consider removing in 4.0 */ $json['startTime'] = tribe_get_start_date($event); $json['endTime'] = tribe_get_end_date($event); } } /** * Internationalization Strings */ $json['i18n']['find_out_more'] = esc_attr__('Find out more »', 'tribe-events-calendar'); $json['i18n']['for_date'] = esc_attr(sprintf(__('%s for', 'tribe-events-calendar'), tribe_get_event_label_plural())); if ($additional) { $json = array_merge((array) $json, (array) $additional); } $json = apply_filters('tribe_events_template_data_array', $json, $event, $additional); $json = tribe_prepare_for_json_deep($json); return json_encode($json); }
/** * Returns json for javascript templating functions throughout the plugin. * * @param $event * @param $additional * * @return string */ function tribe_events_template_data($event, array $additional = null) { $has_image = false; $start_time = ''; $end_time = ''; $image_src = ''; $image_tool_src = ''; // @TODO use tribe_events_event_schedule_details() $date_format = tribe_get_date_format(true); $time_format = get_option('time_format', TribeDateUtils::TIMEFORMAT); $date_time_separator = tribe_get_option('dateTimeSeparator', ' @ '); if (!empty($event->EventStartDate)) { $start_time .= date_i18n($date_format, strtotime($event->EventStartDate)); } if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $start_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventStartDate)); } if (!empty($event->EventEndDate) && $event->EventStartDate !== $event->EventEndDate) { if (date('Y-m-d', strtotime($event->EventStartDate)) == date('Y-m-d', strtotime($event->EventEndDate))) { if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $end_time .= date_i18n($time_format, strtotime($event->EventEndDate)); } } else { $end_time .= date_i18n($date_format, strtotime($event->EventEndDate)); if (!tribe_get_event_meta($event->ID, '_EventAllDay', true)) { $end_time .= $date_time_separator . date_i18n($time_format, strtotime($event->EventEndDate)); } } } if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) { $has_image = true; $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium'); $image_src = $image_arr[0]; } if ($has_image) { $image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75)); $image_tool_src = $image_tool_arr[0]; } if (has_excerpt($event->ID)) { $excerpt = $event->post_excerpt; } else { $excerpt = $event->post_content; } $excerpt = TribeEvents::instance()->truncate($excerpt, 30); $category_classes = tribe_events_event_classes($event->ID, false); $json = array('eventId' => $event->ID, 'title' => $event->post_title, 'permalink' => tribe_get_event_link($event->ID), 'imageSrc' => $image_src, 'startTime' => $start_time, 'endTime' => $end_time, 'imageTooltipSrc' => $image_tool_src, 'excerpt' => $excerpt, 'categoryClasses' => $category_classes); if ($additional) { $json = array_merge((array) $json, (array) $additional); } $json = apply_filters('tribe_events_template_data_array', $json, $event, $additional); $json = tribe_prepare_for_json_deep($json); return json_encode($json); }
<?php $event_id = $event->ID; ?> <div class="single-event-popup <?php echo tribe_events_event_classes( $event_id ); ?>"> <div class="col-sm-4"> <?php echo tribe_event_featured_image( $event_id, 'event-popup', false ); ?> </div> <div class="col-sm-8"> <h2 class="event-title"><?php echo $event->post_title; ?></h2> <?php echo apply_filters( 'the_content', $event->post_content ); ?> <ul class="meta-info"> <li><label>What:</label> <?php echo $event->post_title; ?></li> <li><label>When:</label> <?php echo tribe_events_event_schedule_details( $event_id ); ?></li> <?php if ( tribe_address_exists( $event_id ) ) : ?> <li><label>Where:</label> <?php echo tribe_get_full_address( $event_id ); ?></li> <?php endif; ?> <li><label>Cost:</label> <?php echo get_post_meta( $event_id, '_ecp_custom_2', true ); ?></li> <?php if ( tribe_has_organizer( $event_id ) ): ?> <li><label>Info:</label> <a href="mailto:<?php echo tribe_get_organizer_email( $event_id ); ?>"><?php echo tribe_get_organizer_email( $event_id ); ?></a></li> <?php endif; ?> <li><label>Register:</label> <?php echo get_post_meta( $event_id, '_ecp_custom_5', true ); ?></li> </ul> <?php echo bones_get_edit_link( $event_id ); ?> </div> </div>
if (!defined('ABSPATH')) { die('-1'); } ?> <?php $event = tribe_events_week_get_event(); ?> <div id='tribe-events-event-<?php echo $event->ID; ?> ' <?php tribe_events_the_header_attributes('week-hourly'); ?> class='<?php tribe_events_event_classes($event->ID); ?> tribe-week-event' data-tribejson='<?php echo tribe_events_template_data($event); ?> '> <div class="hentry vevent"> <h3 class="entry-title summary"><a href="<?php tribe_event_link($event); ?> " class="url" rel="bookmark"><?php echo $event->post_title; ?> </a></h3> </div> </div>
* } * * })(window, document); * * Same thing in jQuery: * * (function (window, document, $) { * * $(document).ready(function () { * * $('.tribe_events') * .each(function () { * * var obj = $(this).data('tribejson'); * * console.log('Event title is: ' + obj.title); * * }); * * }); * * })(window, document, jQuery); * */ ?> <div id="tribe-events-event-<?php echo esc_attr( $event_id ); ?>" class="<?php tribe_events_event_classes() ?>" data-tribejson='<?php echo esc_attr( tribe_events_template_data( $post ) ); ?>'> <h3 class="tribe-events-month-event-title entry-title summary"><a href="<?php echo esc_url( $link ) ?>" class="url fancybox fancybox.ajax"><?php echo $title ?></a></h3> </div><!-- #tribe-events-event-# -->