/** * Display ticket information. * * @since 1.0.0 * * @param string $before Optional. String to prepend to the default HTML. * @param string $after Optional. String to append to the default HTML. * @return string */ function huesos_the_audiotheme_tickets_html($before = '', $after = '') { $gig_tickets_price = get_audiotheme_gig_tickets_price(); $gig_tickets_url = get_audiotheme_gig_tickets_url(); if (!$gig_tickets_price || !$gig_tickets_url) { return; } $html = __('Tickets', 'huesos'); if ($gig_tickets_price) { $html .= sprintf(' <span class="gig-ticket-price" itemprop="price">%s</span>', esc_html($gig_tickets_price)); } if ($gig_tickets_url) { $html = sprintf('<a class="gig-tickets-link button js-maybe-external" href="%s" itemprop="url">%s</a>', esc_html($gig_tickets_price), $html); } echo $before . $html . $after; // XSS OK }
<div class="audiotheme-gig-meta-tickets" itemprop="offers" itemscope itemtype="http://schema.org/Offer"> <?php if ($gig_tickets_price = get_audiotheme_gig_tickets_price()) { ?> <span class="audiotheme-gig-tickets-price" itemprop="price"><?php echo esc_html($gig_tickets_price); ?> </span> <?php } ?> <?php if ($gig_tickets_url = get_audiotheme_gig_tickets_url()) { ?> <span class="audiotheme-gig-tickets-link" > <a href="<?php echo esc_url($gig_tickets_url); ?> " target="_blank" itemprop="url"><?php _e('Buy Tickets', 'audiotheme'); ?> </a> </span> <?php } ?> </div><!-- /.gig-meta-tickets -->