Advertisement
BakerMan

Thumbless related events for single event page

Aug 27th, 2013
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.13 KB | None | 0 0
  1. /**
  2.  * Echos the single events page related events boxes, but without thumbnail images (essentially duplicates the
  3.  * plugin's own single related event code, but runs sans-featured image).
  4.  *
  5.  * @param mixed $tag The specific tags you want it relating to.
  6.  * @param mixed $category The specific categories you want it relating to.
  7.  * @param int $count The number of related events to find.
  8.  * @param mixed $blog What blog/site should they come from?
  9.  * @param bool $only_display_related Should we show only related events if we don't find $count number of related ones?
  10.  * @param string $post_type What post type are we finding related things in?
  11.  * @return void.
  12.  */
  13. function tribe_thumbless_single_related_events( $tag = false, $category = false, $count = 3, $blog = false, $only_display_related = true, $post_type = TribeEvents::POSTTYPE ) {
  14.     $posts = tribe_get_related_posts( $tag, $category, $count, $blog, $only_display_related, $post_type );
  15.     if ( is_array( $posts ) && !empty( $posts ) ) {
  16.         echo '<h3 class="tribe-events-related-events-title">'.  __( 'Related Events', 'tribe-events-calendar-pro' ) .'</h3>';
  17.         echo '<ul class="tribe-related-events tribe-clearfix hfeed vcalendar">';
  18.         foreach ( $posts as $post ) {
  19.             echo '<li>';
  20.  
  21.             echo '<div class="tribe-related-event-info">';
  22.             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>';
  23.  
  24.             if ( class_exists( 'TribeEvents' ) && $post->post_type == TribeEvents::POSTTYPE && function_exists( 'tribe_events_event_schedule_details' ) ) {
  25.                 echo tribe_events_event_schedule_details( $post );
  26.             }
  27.             if ( class_exists( 'TribeEvents' ) && $post->post_type == TribeEvents::POSTTYPE && function_exists( 'tribe_events_event_recurring_info_tooltip' ) ) {
  28.                 echo tribe_events_event_recurring_info_tooltip( $post->ID );
  29.             }
  30.             echo '</div>';
  31.             echo '</li>';
  32.         }
  33.         echo '</ul>';
  34.     }
  35. }
  36.  
  37. remove_action('tribe_events_single_event_after_the_meta', 'tribe_single_related_events');
  38. add_action('tribe_events_single_event_after_the_meta', 'tribe_thumbless_single_related_events');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement