コード例 #1
0
ファイル: Abstract.php プロジェクト: nullify005/shcc-website
 /**
  * Compile the schema.org event data into an array
  */
 public function get_data($post = null, $args = array())
 {
     if (!$post instanceof WP_Post) {
         $post = Tribe__Main::post_id_helper($post);
     }
     $post = get_post($post);
     if (!$post instanceof WP_Post) {
         return array();
     }
     $data = (object) array();
     // We may need to prevent the context to be triggered
     if (!isset($args['context']) || false !== $args['context']) {
         $data->{'@context'} = 'http://schema.org';
     }
     $data->{'@type'} = $this->type;
     $data->name = esc_js(get_the_title($post));
     $data->description = esc_js(tribe_events_get_the_excerpt($post));
     if (has_post_thumbnail($post)) {
         $data->image = wp_get_attachment_url(get_post_thumbnail_id($post));
     }
     $data->url = esc_url_raw(get_permalink($post));
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     return array($post->ID => $data);
 }
コード例 #2
0
 /**
  * Compile the schema.org event data into an array
  */
 protected function build_data()
 {
     global $post;
     $id = $post->ID;
     $data = array();
     // Index by ID: this will allow filter code to identify the actual event being referred to
     // without injecting an additional property
     $data[$id] = new stdClass();
     $data[$id]->{'@context'} = 'http://schema.org';
     $data[$id]->{'@type'} = 'Thing';
     $data[$id]->name = get_the_title();
     $data[$id]->description = tribe_events_get_the_excerpt($post);
     if (has_post_thumbnail()) {
         $data[$id]->image = wp_get_attachment_url(get_post_thumbnail_id($id));
     }
     $data[$id]->url = get_permalink($id);
     return $data;
 }
コード例 #3
0
				<?php 
    echo implode(', ', $venue_details);
    ?>
			</div> <!-- .tribe-events-venue-details -->
		<?php 
}
?>

	</div>
</div><!-- .tribe-events-event-meta -->
<?php 
do_action('tribe_events_after_the_meta');
?>

<!-- Event Image -->
<?php 
echo tribe_event_featured_image(null, 'medium');
?>

<!-- Event Content -->
<?php 
do_action('tribe_events_before_the_content');
?>
<div class="tribe-events-list-event-description tribe-events-content">
	<?php 
echo tribe_events_get_the_excerpt();
?>

</div><!-- .tribe-events-list-event-description -->
<?php 
do_action('tribe_events_after_the_content');
コード例 #4
0
 /**
  * Returns json for javascript templating functions throughout the plugin.
  *
  * @category Events
  *
  * @param $event
  * @param $additional
  *
  * @return string
  */
 function tribe_events_template_data($event = null, array $additional = null)
 {
     // Base JSON variable
     $json = array('i18n' => array());
     if (!is_null($event)) {
         $event = get_post($event);
         // Check if we are dealing with an Event
         if (is_object($event) && $event instanceof WP_Post && tribe_is_event($event->ID)) {
             $has_image = false;
             $image_src = '';
             $image_tool_src = '';
             $date_display = '';
             //Disable recurring event info in tooltip
             if (class_exists('Tribe__Events__Pro__Main')) {
                 $ecp = Tribe__Events__Pro__Main::instance();
                 $ecp->disable_recurring_info_tooltip();
                 $date_display = strip_tags(tribe_events_event_schedule_details($event));
                 // Re-enable recurring event info
                 $ecp->enable_recurring_info_tooltip();
             } else {
                 $date_display = strip_tags(tribe_events_event_schedule_details($event));
             }
             if (function_exists('has_post_thumbnail') && has_post_thumbnail($event->ID)) {
                 $has_image = true;
                 $image_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), 'medium');
                 $image_src = $image_arr[0];
             }
             if ($has_image) {
                 $image_tool_arr = wp_get_attachment_image_src(get_post_thumbnail_id($event->ID), array(75, 75));
                 $image_tool_src = $image_tool_arr[0];
             }
             $category_classes = tribe_events_event_classes($event->ID, false);
             $json['eventId'] = $event->ID;
             $json['title'] = $event->post_title;
             $json['permalink'] = tribe_get_event_link($event->ID);
             $json['imageSrc'] = $image_src;
             $json['dateDisplay'] = $date_display;
             $json['imageTooltipSrc'] = $image_tool_src;
             $json['excerpt'] = tribe_events_get_the_excerpt($event);
             $json['categoryClasses'] = $category_classes;
             /**
              * Template overrides (of month/tooltip.php) set up in 3.9.3 or earlier may still expect
              * these vars and will break without them, so they are being kept temporarily for
              * backwards compatibility purposes.
              *
              * @todo consider removing in 4.0
              */
             $json['startTime'] = tribe_get_start_date($event);
             $json['endTime'] = tribe_get_end_date($event);
         }
     }
     /**
      * Internationalization Strings
      */
     $json['i18n']['find_out_more'] = esc_attr__('Find out more »', 'the-events-calendar');
     $json['i18n']['for_date'] = sprintf(esc_attr__('%s for', 'the-events-calendar'), tribe_get_event_label_plural());
     if ($additional) {
         $json = array_merge((array) $json, (array) $additional);
     }
     $json = apply_filters('tribe_events_template_data_array', $json, $event, $additional);
     $json = tribe_prepare_for_json_deep($json);
     return json_encode($json);
 }
コード例 #5
0
ファイル: content.php プロジェクト: nullify005/shcc-website
<?php

/**
 * Embed Content Template
 *
 * The content template for the embed view.
 *
 * Override this template in your own theme by creating a file at [your-theme]/tribe-events/embed/content.php
 *
 * @version 4.2
 *
 * @package TribeEventsCalendar
 *
 */
if (!defined('ABSPATH')) {
    die('-1');
}
?>
<div class="tribe-events-single-event-description tribe-events-content">
	<?php 
echo tribe_events_get_the_excerpt(null, wp_kses_allowed_html('post'));
?>
</div>
<?php 
/**
 * Print additional content after the embed excerpt.
 *
 * @since 4.4.0
 */
do_action('embed_content');
コード例 #6
0
function tribe_upcoming_events($atts)
{
    // Attributes
    extract(shortcode_atts(array('number' => 3, 'usecols' => true, 'cols' => 3), $atts));
    // Code
    add_filter('excerpt_length', 'tekserve_studio_excerpt_length', 999);
    $html = '<div id="tribe-events-content" class="tekserve-studio-tribe-events tribe-events-list tribe-events-photo">
		<div class="tribe-events-loop hfeed vcalendar tribe-clearfix" id="tribe-events-photo-events">';
    $args = array('post_type' => 'tribe_events', 'post_status' => 'publish', 'posts_per_page' => $number);
    $the_query = new WP_Query($args);
    // The Loop
    if ($the_query->have_posts()) {
        if ($usecols) {
            if (intval($cols) > 12) {
                $cols = intval($cols / 12);
            }
            //end if( intval( $cols ) > 12 )
            $colsize = intval(12 / $cols);
            $coltag = '[column size="' . $colsize . '" col_class="md"]';
            $i = 0;
            while ($the_query->have_posts()) {
                $post = $the_query->the_post();
                if ($i == 0) {
                    $html .= '[row]';
                }
                //end if( $i == 0 )
                $html .= $coltag;
                $html .= '<div class="tribe-events-photo-event-wrap">';
                $html .= tribe_event_featured_image(null, 'medium');
                $html .= '<div class="tribe-events-event-details tribe-clearfix">';
                $html .= print_r(do_action('tribe_events_before_the_event_title'), true);
                $html .= '<h3 class="tribe-events-list-event-title entry-title summary">';
                $html .= '<a class="url" href="' . esc_url(tribe_get_event_link()) . '" title="' . the_title('', '', false) . '" rel="bookmark">';
                $html .= the_title('', '', false);
                $html .= '</a></h3>';
                $html .= print_r(do_action('tribe_events_after_the_event_title'), true);
                $html .= print_r(do_action('tribe_events_before_the_meta'), true);
                $html .= '<div class="tribe-events-event-meta">
								<div class="updated published time-details">';
                if (!empty($post->distance)) {
                    $html .= '<strong>[' . tribe_get_distance_with_unit($post->distance) . ']</strong>';
                }
                //end if( ! empty( $post->distance ) )
                $html .= tribe_events_event_schedule_details();
                $html .= '</div>
					</div>';
                $html .= print_r(do_action('tribe_events_after_the_meta'), true);
                $html .= print_r(do_action('tribe_events_before_the_content'), true);
                $html .= '<div class="tribe-events-list-photo-description tribe-events-content entry-summary description">';
                $html .= tribe_events_get_the_excerpt();
                $html .= '</div>';
                $html .= print_r(do_action('tribe_events_after_the_content'), true);
                $html .= '	</div>
				</div>';
                $html .= '[/column]';
                if ($i == intval($cols - 1)) {
                    $html .= '[/row]';
                }
                //end if( $i == intval( $cols-1 ) )
                if ($i < $cols) {
                    $i++;
                } else {
                    $i = 0;
                }
                //end if( $i < $cols )
            }
            //end while( $the_query->have_posts() )
        } else {
            while ($the_query->have_posts()) {
                $post = $the_query->the_post();
                $html .= '<div class="tribe-events-photo-event-wrap">';
                $html .= tribe_event_featured_image(null, 'medium');
                $html .= '<div class="tribe-events-event-details tribe-clearfix">';
                $html .= print_r(do_action('tribe_events_before_the_event_title'), true);
                $html .= '<h3 class="tribe-events-list-event-title entry-title summary">';
                $html .= '<a class="url" href="' . esc_url(tribe_get_event_link()) . '" title="' . the_title('', '', false) . '" rel="bookmark">';
                $html .= the_title('', '', false);
                $html .= '</a></h3>';
                $html .= print_r(do_action('tribe_events_after_the_event_title'), true);
                $html .= print_r(do_action('tribe_events_before_the_meta'), true);
                $html .= '<div class="tribe-events-event-meta">
								<div class="updated published time-details">';
                if (!empty($post->distance)) {
                    $html .= '<strong>[' . tribe_get_distance_with_unit($post->distance) . ']</strong>';
                }
                //end if( ! empty( $post->distance ) )
                $html .= tribe_events_event_schedule_details();
                $html .= '</div>
					</div>';
                $html .= print_r(do_action('tribe_events_after_the_meta'), true);
                $html .= print_r(do_action('tribe_events_before_the_content'), true);
                $html .= '<div class="tribe-events-list-photo-description tribe-events-content entry-summary description">';
                $html .= tribe_events_get_the_excerpt();
                $html .= '</div>';
                $html .= print_r(do_action('tribe_events_after_the_content'), true);
                $html .= '	</div>
				</div>';
            }
            //end while( $the_query->have_posts() )
        }
        //end if( $usecols )
    } else {
        return '<h3 class="error">There are currently no upcoming events.</h3>';
    }
    //end if( $the_query->have_posts() )
    $html .= '	</div>
	</div>';
    return do_shortcode($html);
}