/** * Add additional HTML classes to posts. * * @since 1.0.0 * * @param array $classes List of HTML classes. * @return array */ function huesos_audiotheme_post_class($classes) { if ('' === get_the_title()) { $classes[] = 'no-title'; } if (is_singular('audiotheme_gig') && audiotheme_gig_has_venue()) { $classes[] = 'has-venue'; } if ('audiotheme_video' === get_post_type() && get_audiotheme_video_url()) { $classes[] = 'has-video'; } return array_unique($classes); }
?> " <?php post_class(); ?> itemscope itemtype="http://schema.org/MusicEvent"> <header class="entry-header"> <?php the_title('<h1 class="entry-title" itemprop="name">', '</h1>'); ?> <?php get_template_part('audiotheme/parts/gig-meta'); ?> </header> <?php if (audiotheme_gig_has_venue()) { ?> <div class="entry-meta content-side"> <?php get_template_part('audiotheme/parts/venue-meta'); ?> </div> <?php } ?> <div class="entry-content content" itemprop="description"> <?php the_content(''); ?> </div>
<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 } ?> <?php if ($gig_description = get_audiotheme_gig_description()) { ?> <dd class="description"><?php echo wp_strip_all_tags($gig_description); ?>
/** * 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; }