BakerMan

Use default title for single events with default page tpl

Jul 18th, 2013
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. add_filter('the_title', 'tribe_restore_title');
  2.  
  3. function tribe_restore_title($title) {
  4.     global $wp_query;
  5.     global $post;
  6.  
  7.     if (-9999 !== $post->ID) return $title;
  8.     if ( ! $wp_query->is_singular || ! isset($wp_query->tribe_is_event) || ! $wp_query->tribe_is_event) return $title;
  9.     if ( ! is_a($wp_query->posts[0], 'WP_Post') || $wp_query->posts[0]->ID == $post->ID) return $title;
  10.  
  11.     return $wp_query->posts[0]->post_title;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment