/** * Retrieve gig information in markup suitable for a RSS description. * * @since 1.0.0 * @uses get_audiotheme_venue_vcard_rss() * * @param int|object $post Optional post ID or object. Default is global $post object. * @return string */ function get_audiotheme_gig_rss_description($post = null) { $gig = get_audiotheme_gig($post); $output = '<strong>' . get_audiotheme_gig_time('l, F j, Y', ' @ g:i a') . '</strong>'; $output .= empty($gig->venue) ? '' : get_audiotheme_venue_vcard($gig->venue->ID, array('container' => 'div')); $output .= empty($gig->post_excerpt) ? '' : wpautop($gig->post_excerpt); return $output; }
* Gigs JSON feed template. * * @package AudioTheme_Framework * @subpackage Gigs */ @header('Content-Type: application/json; charset=' . get_option('blog_charset')); foreach ($wp_query->posts as $post) { $post = get_audiotheme_gig($post); $event = new stdClass(); $event->id = $post->ID; $event->title = $post->post_title; $event->description = $post->post_excerpt; $event->url = get_permalink($post->ID); $event->start->date = get_audiotheme_gig_time('Y-m-d'); $event->start->time = get_post_meta($post->ID, '_audiotheme_gig_time', true); $event->start->datetime = get_audiotheme_gig_time('c', '', true); // @todo Attempt to add a property to display the date in UTC. if (!empty($post->venue)) { $event->venue->ID = $post->venue->ID; $event->venue->name = $post->venue->name; $event->venue->url = $post->venue->website; $event->venue->phone = $post->venue->phone; $event->venue->location->street = $post->venue->address; $event->venue->location->city = $post->venue->city; $event->venue->location->state = $post->venue->state; $event->venue->location->postalcode = $post->venue->postal_code; $event->venue->location->country = $post->venue->country; $event->venue->location->timezone = $post->venue->timezone_string; } $events[] = $event; }
<?php } ?> <dd class="gig-date date"> <meta content="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> " itemprop="startDate"> <time class="dtstart" datetime="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> "> <?php echo esc_html(get_audiotheme_gig_time(get_option('date_format', 'M d, Y'))); ?> </time> </dd> <?php if (audiotheme_gig_has_venue()) { ?> <dd class="gig-location location vcard" itemprop="location" itemscope itemtype="http://schema.org/EventVenue"> <?php the_audiotheme_venue_vcard(array('container' => '', 'show_name_link' => false, 'show_phone' => false, 'separator_country' => '/')); ?> </dd>
</dd> <?php } ?> <dd class="date"> <meta content="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> " itemprop="startDate"> <time class="dtstart" datetime="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> "> <?php echo get_audiotheme_gig_time($date_format); ?> </time> </dd> <?php if (!empty($gig->post_title) && audiotheme_gig_has_venue()) { ?> <dd class="venue"><?php echo esc_html(get_audiotheme_venue($gig->venue->ID)->name); ?> </dd> <?php } ?>
echo get_audiotheme_gig_time('c'); ?> " itemprop="startDate"> <time datetime="<?php echo get_audiotheme_gig_time('c'); ?> "> <span class="audiotheme-gig-date"><a href="<?php the_permalink(); ?> " class="audiotheme-gig-permalink" itemprop="url"><?php echo get_audiotheme_gig_time('M d, Y'); ?> </a></span> <span class="audiotheme-gig-time"><?php echo get_audiotheme_gig_time('', 'g:i A'); ?> </span> </time> </div><!-- /.gig-meta-datetime --> <div class="audiotheme-gig-details"> <?php the_title('<h2 class="audiotheme-gig-title" itemprop="name">', '</h2>'); ?> <?php if (audiotheme_gig_has_venue()) { ?>
?> </span> <span class="gig-list-location"><?php esc_html_e('Location', 'huesos'); ?> </span> </header> <?php $last_year_shown = ''; while (have_posts()) { the_post(); ?> <?php $year = get_audiotheme_gig_time('Y'); if ($year !== $last_year_shown) { echo '<h2 class="gig-list-year">' . esc_html($year) . '</h2>'; } $last_year_shown = $year; ?> <dl id="post-<?php the_ID(); ?> " <?php post_class('gig-card vevent'); ?> itemscope itemtype="http://schema.org/MusicEvent"> <?php get_template_part('audiotheme/parts/gig-card');
header('Content-type: text/calendar'); header('Content-Disposition: attachment; filename="audiotheme-gigs.ics"'); ?> BEGIN:VCALENDAR VERSION:2.0 PRODID:-//AudioTheme <?php echo AUDIOTHEME_VERSION; ?> <?php foreach ($wp_query->posts as $post) { $post = get_audiotheme_gig($post); echo "BEGIN:VEVENT\n"; echo 'UID:' . get_the_guid($post->ID) . "\n"; echo 'URL:' . get_permalink($post->ID) . "\n"; $date = get_audiotheme_gig_time('Ymd', '', true); $time = get_audiotheme_gig_time('', 'His', true); $dtstart = sprintf("DTSTART%s%s%s\n", empty($time) ? ';VALUE=DATE:' : ';TZID=GMT:', $date, empty($time) ? '' : 'T' . $time); echo $dtstart; echo 'SUMMARY:' . get_audiotheme_gig_title() . "\n"; if (!empty($post->post_excerpt)) { echo 'DESCRIPTION:' . escape_ical_text($post->post_excerpt) . "\n"; } if (!empty($post->venue)) { $location = get_audiotheme_venue_location_ical($post->venue->ID); echo empty($location) ? '' : 'LOCATION:' . $location . "\n"; } echo "END:VEVENT\n"; } ?> END:VCALENDAR
/** * Get a link to add a gig to Google Calendar. * * @since 1.0.0 * * @todo Need to add the artists' name to provide context in Google Calendar. * * @param int|object $post Optional post ID or object. Default is global $post object. * @return string */ function get_audiotheme_gig_gcal_link($post = null) { $gig = get_audiotheme_gig($post); $date = get_audiotheme_gig_time('Ymd', '', true); $time = get_audiotheme_gig_time('', 'His', true); $dtstart = $date; $dtstart .= empty($time) ? '' : 'T' . $time . 'Z'; $location = ''; if (audiotheme_gig_has_venue($gig)) { $venue = get_audiotheme_venue($gig->venue->ID); $location = $venue->name; $location .= empty($venue->address) ? '' : ', ' . esc_html($venue->address); $location .= empty($venue->city) ? '' : ', ' . $venue->city; $location .= !empty($location) && !empty($venue->state) ? ', ' : ''; $location .= empty($venue->state) ? '' : $venue->state; if (!empty($venue->country)) { $location .= !empty($location) ? ', ' : ''; $location .= empty($venue->country) ? '' : $venue->country; } } $args = array('action' => 'TEMPLATE', 'text' => rawurlencode(wp_strip_all_tags(get_audiotheme_gig_title())), 'dates' => $dtstart . '/' . $dtstart, 'details' => rawurlencode(wp_strip_all_tags(get_audiotheme_gig_description())), 'location' => rawurlencode($location), 'sprop' => rawurlencode(home_url('/'))); $link = add_query_arg($args, 'https://www.google.com/calendar/event'); return $link; }
} ?> <?php the_audiotheme_gig_description('<div class="audiotheme-gig-note" itemprop="description">', '</div>'); ?> </dd><!-- /.gig-description --> <dd class="audiotheme-gig-meta audiotheme-meta-list"> <span class="audiotheme-gig-time audiotheme-meta-item"> <strong class="audiotheme-label"><?php _e('Time', 'audiotheme'); ?> </strong> <?php echo get_audiotheme_gig_time('', 'g:i A', false, array('empty_time' => __('TBD', 'audiotheme'))); ?> </span> <?php if (audiotheme_gig_has_ticket_meta()) { ?> <span class="audiotheme-gig-tickets audiotheme-meta-item" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <strong class="audiotheme-label"><?php _e('Admission', 'audiotheme'); ?> </strong> <?php if ($gig_tickets_price = get_audiotheme_gig_tickets_price()) {
if (strlen($post->post_content) > 0) { ?> <content:encoded><![CDATA[<?php the_content_feed('rss2'); ?> ]]></content:encoded> <?php } ?> <ev:startdate><?php echo get_audiotheme_gig_time(); ?> </ev:startdate> <ev:type>concert</ev:type> <xcal:dtstart><?php echo get_audiotheme_gig_time(); ?> </xcal:dtstart> <?php if (!empty($gig->venue)) { echo get_audiotheme_venue_vcard_rss($gig->venue->ID); } ?> </item> <?php } ?> </channel> </rss>
<meta content="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> " itemprop="startDate"> <time datetime="<?php echo esc_attr(get_audiotheme_gig_time('c')); ?> "> <?php echo esc_html(get_audiotheme_gig_time(get_option('date_format', 'F d, Y'))); ?> </time> </span> <span class="gig-time"><?php echo esc_html(get_audiotheme_gig_time('', 'g:i A', false, array('empty_time' => __('TBD', 'huesos')))); ?> </span> </h2> <h3 class="gig-location"> <?php echo get_audiotheme_venue_location($gig->venue->ID); ?> </h3> <?php the_audiotheme_gig_description('<div class="gig-description" itemprop="description">', '</div>'); ?> <?php