コード例 #1
0
ファイル: template-tags.php プロジェクト: razeenmk/quotekart
 /**
  * Output Eventbrite event information such as date, time, venue, and organizer
  */
 function writr_eventbrite_event_meta()
 {
     // Start with the event time.
     $time = sprintf('<li class="event-time"><span class="screen-reader-text">%s</span>%s</li>', esc_html__('Event date and time', 'writr'), eventbrite_event_time());
     // Add a venue name if available.
     $venue = '';
     if (!empty(eventbrite_event_venue()->name)) {
         $venue = sprintf('<li class="event-venue"><span class="screen-reader-text">%s</span><a class="event-venue-link url fn n" href="%s">%s</a></li>', esc_html__('Venue', 'writr'), esc_url(eventbrite_venue_get_archive_link()), esc_html(eventbrite_event_venue()->name));
     }
     // Add the organizer's name if available. Author-related functions are filtered to use the event's organizer.
     $organizer = '';
     if (!empty(eventbrite_event_organizer()->name)) {
         $organizer = sprintf('<li class="event-organizer"><span class="screen-reader-text">%s</span><a class="event-organizer-link url fn n" href="%s">%s</a></li>', esc_html__('Organizer', 'writr'), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author()));
     }
     // Add a contextual link to event details.
     if (eventbrite_is_single()) {
         // Link to event info on eventbrite.com.
         $url = add_query_arg(array('ref' => 'wporglink'), eventbrite_event_eb_url());
     } else {
         // Link to the event single view.
         $url = get_the_permalink();
     }
     $details = sprintf('<li class="event-details"><a class="event-details-link" href="%s">%s</a></li>', esc_url($url), esc_html__('Details', 'writr'));
     // Add an event Edit link.
     $edit = '';
     if (current_user_can('edit_posts')) {
         $url = add_query_arg(array('eid' => get_the_ID(), 'ref' => 'wporgedit'), 'https://eventbrite.com/edit');
         $edit = sprintf('<li class="event-edit"><a href="%s">%s</a></li>', esc_url($url), esc_html__('Edit', 'writr'));
     }
     // Assemble our HTML. Yugly.
     $html = sprintf('<ul class="clear">%1$s%2$s%3$s%4$s%5$s</ul>', $time, $venue, $organizer, $details, $edit);
     echo apply_filters('eventbrite_event_meta', $html, $time, $venue, $organizer, $details, $edit);
 }
コード例 #2
0
 /**
  * Output event information such as date, time, venue, and organizer
  */
 function eventbrite_event_meta()
 {
     // Determine our separator.
     $separator = apply_filters('eventbrite_meta_separator', '<span class="sep"> &middot; </span>');
     // Start our HTML output with the event time.
     $time = '<span class="event-time">' . eventbrite_event_time() . '</span>';
     // Add a venue name if available.
     $venue = '';
     if (!empty(eventbrite_event_venue()->name)) {
         $venue = sprintf('%s<span class="event-venue"><a class="event-venue-link url fn n" href="%s"><span class="event-venue-text">%s</span></a></span>', wp_kses($separator, array('span' => array('class' => array()))), esc_url(eventbrite_venue_get_archive_link()), esc_html(eventbrite_event_venue()->name));
     }
     // Add the organizer's name if available. Author-related functions are filtered to use the event's organizer.
     $organizer = '';
     if (!empty(eventbrite_event_organizer()->name)) {
         $organizer = sprintf('%s<span class="event-organizer"><a class="event-organizer-link url fn n" href="%s"><span class="event-organizer-text">%s</span></a></span>', wp_kses($separator, array('span' => array('class' => array()))), esc_url(get_author_posts_url(get_the_author_meta('ID'))), esc_html(get_the_author()));
     }
     // Add a contextual link to event details.
     if (eventbrite_is_single()) {
         // Link to event info on eventbrite.com.
         $url = add_query_arg(array('ref' => 'wporglink'), eventbrite_event_eb_url());
     } else {
         // Link to the event single view.
         $url = get_the_permalink();
     }
     $details = sprintf('%s<span class="event-details"><a class="event-details-link" href="%s"><span class="event-details-text">%s</span></a></span>', wp_kses($separator, array('span' => array('class' => array()))), esc_url($url), esc_html__('Details', 'eventbrite_api'));
     // Assemble our HTML. Yugly.
     $html = sprintf(_x('%1$s%2$s%3$s%4$s', '%1$s: time, %2$s: venue, %3$s: organizer, %4$s: event details (only on index views)', 'eventbrite-api'), $time, $venue, $organizer, $details);
     echo apply_filters('eventbrite_event_meta', $html, $time, $venue, $organizer, $details);
 }