Esempio n. 1
0
 /**
  * Echos the single events page related events boxes.
  *
  * @param mixed $tag The specific tags you want it relating to.
  * @param mixed $category The specific categories you want it relating to.
  * @param int $count The number of related events to find.
  * @param mixed $blog What blog/site should they come from?
  * @param bool $only_display_related Should we show only related events if we don't find $count number of related ones?
  * @param string $post_type What post type are we finding related things in?
  * @return void.
  */
 function tribe_single_related_events($tag = false, $category = false, $count = 3, $blog = false, $only_display_related = true, $post_type = TribeEvents::POSTTYPE)
 {
     $posts = tribe_get_related_posts($tag, $category, $count, $blog, $only_display_related, $post_type);
     if (is_array($posts) && !empty($posts)) {
         echo '<h3 class="tribe-events-related-events-title">' . __('Related Events', 'tribe-events-calendar-pro') . '</h3>';
         echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">';
         foreach ($posts as $post) {
             echo '<li>';
             $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/images/tribe-related-events-placeholder.png" alt="' . get_the_title($post->ID) . '" />';
             echo '<div class="tribe-related-events-thumbnail">';
             echo '<a href="' . get_permalink($post->ID) . '" class="url" rel="bookmark">' . $thumb . '</a>';
             echo '</div>';
             echo '<div class="tribe-related-event-info">';
             echo '<h3 class="tribe-related-events-title summary"><a href="' . get_permalink($post->ID) . '" class="url" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>';
             if (class_exists('TribeEvents') && $post->post_type == TribeEvents::POSTTYPE && function_exists('tribe_events_event_schedule_details')) {
                 echo tribe_events_event_schedule_details($post);
             }
             if (class_exists('TribeEvents') && $post->post_type == TribeEvents::POSTTYPE && function_exists('tribe_events_event_recurring_info_tooltip')) {
                 echo tribe_events_event_recurring_info_tooltip($post->ID);
             }
             echo '</div>';
             echo '</li>';
         }
         echo '</ul>';
     }
 }
 *
 * You can use any or all filters included in this file or create your own filters in 
 * your functions.php. In order to modify or extend a single filter, please see our
 * readme on templates hooks and filters
 *
 * @package TribeEventsCalendarPro
 * @since  3.6
 * @author Modern Tribe Inc.
 *
 */
if (!defined('ABSPATH')) {
    die('-1');
}
//Maximum Number of related posts to display
$num_posts = 3;
$posts = tribe_get_related_posts($num_posts);
?>

<?php 
if (is_array($posts) && !empty($posts)) {
    echo '<h3 class="tribe-events-related-events-title">' . __('Related Events', 'tribe-events-calendar-pro') . '</h3>';
    echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">';
    foreach ($posts as $post) {
        echo '<li>';
        $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/images/tribe-related-events-placeholder.png" alt="' . get_the_title($post->ID) . '" />';
        echo '<div class="tribe-related-events-thumbnail">';
        echo '<a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . $thumb . '</a>';
        echo '</div>';
        echo '<div class="tribe-related-event-info">';
        echo '<h3 class="tribe-related-events-title summary"><a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>';
        if ($post->post_type == TribeEvents::POSTTYPE) {
Esempio n. 3
0
 /**
  * Get Related Events
  *
  * Get a list of related events to the current post
  *
  * @param int $count
  *
  * @return array Array of events
  * @deprecated
  * @todo remove in 3.11
  */
 function tribe_get_related_events($count = 3)
 {
     _deprecated_function(__FUNCTION__, '3.9', 'tribe_get_related_posts');
     $posts = tribe_get_related_posts($count);
     if (has_filter('tribe_get_related_events')) {
         _deprecated_function("The 'tribe_get_related_events' filter", '3.9', " the 'tribe_get_related_posts' filter");
         $posts = apply_filters('tribe_get_related_events', $posts);
     }
     return $posts;
 }
 *
 * You can recreate an ENTIRELY new related events view by doing a template override, and placing
 * a related-events.php file in a tribe-events/pro/ directory within your theme directory, which
 * will override the /views/related-events.php.
 *
 * You can use any or all filters included in this file or create your own filters in
 * your functions.php. In order to modify or extend a single filter, please see our
 * readme on templates hooks and filters
 *
 * @package TribeEventsCalendarPro
 *
 */
if (!defined('ABSPATH')) {
    die('-1');
}
$posts = tribe_get_related_posts();
if (is_array($posts) && !empty($posts)) {
    ?>

<div class="related-posts single-related-posts">
	<?php 
    echo Avada()->template->title_template(sprintf(__('Related %s', 'tribe-events-calendar-pro'), tribe_get_event_label_plural()), '3');
    ?>

	<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">
		<?php 
    foreach ($posts as $post) {
        ?>
		<li>
			<?php 
        $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . esc_url(trailingslashit(Tribe__Events__Pro__Main::instance()->pluginUrl) . 'src/resources/images/tribe-related-events-placeholder.png') . '" alt="' . esc_attr(get_the_title($post->ID)) . '" />';
Esempio n. 5
0
 /**
  * Echos the single events page related events boxes.
  *
  * @param mixed $tag The specific tags you want it relating to.
  * @param mixed $category The specific categories you want it relating to.
  * @param int $count The number of related events to find.
  * @return void.
  */
 function tribe_single_related_events($count = 3)
 {
     $posts = tribe_get_related_posts($count);
     if (is_array($posts) && !empty($posts)) {
         echo '<h3 class="tribe-events-related-events-title">' . __('Related Events', 'tribe-events-calendar-pro') . '</h3>';
         echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">';
         foreach ($posts as $post) {
             echo '<li>';
             $thumb = has_post_thumbnail($post->ID) ? get_the_post_thumbnail($post->ID, 'large') : '<img src="' . trailingslashit(TribeEventsPro::instance()->pluginUrl) . 'resources/images/tribe-related-events-placeholder.png" alt="' . get_the_title($post->ID) . '" />';
             echo '<div class="tribe-related-events-thumbnail">';
             echo '<a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . $thumb . '</a>';
             echo '</div>';
             echo '<div class="tribe-related-event-info">';
             echo '<h3 class="tribe-related-events-title summary"><a href="' . tribe_get_event_link($post) . '" class="url" rel="bookmark">' . get_the_title($post->ID) . '</a></h3>';
             if ($post->post_type == TribeEvents::POSTTYPE) {
                 echo tribe_events_event_schedule_details($post);
             }
             echo '</div>';
             echo '</li>';
         }
         echo '</ul>';
     }
 }