Guest User

Events Calendar Page Title - Fix Leading Sep Default Templat

a guest
Sep 24th, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. /* Fix Calendar Page Titles */
  2. /**
  3. * When something other than the Default Events Template is in use a trailing
  4. * separator can be applied to single event titles ... this code aims to
  5. * resolve that.
  6. */
  7. add_filter('tribe_events_add_title', 'fix_leading_tribal_pipe', 20, 3);
  8.  
  9. function fix_leading_tribal_pipe($title, $prev, $sep) {
  10. // We're only interested if the Default Events Template *is* in play
  11. if ('default' == TribeEvents::instance()->getOption('tribeEventsTemplate')) return $title;
  12.  
  13. // Confirmation: ensure separator is the first symbol (there will be a leading space)
  14. if (1 !== strpos($title, $sep)) return $title;
  15.  
  16. // Strip it (account for the leading space)
  17. return substr($title, strlen($sep) + 1);
  18. }
Advertisement
Add Comment
Please, Sign In to add comment