</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 } ?> <?php if ($gig_description = get_audiotheme_gig_description()) { ?> <dd class="description"><?php echo wp_strip_all_tags($gig_description); ?> </dd> <?php } ?> </dl> <?php } ?>
/** * 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; }