Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <?php
  2. // Prepends category name(s) to event titles
  3. function tribe_events_title_include_cat ($title, $id) {
  4.  
  5. $separator = ' &raquo; '; // Separator between categories and title
  6. $cats = get_the_terms($id, 'tribe_events_cat');
  7.  
  8. if (tribe_is_event($id) && $cats && !is_single()) {
  9. $cat_titles = array();
  10. foreach($cats as $i) {
  11. $cat_titles[] = $i->name;
  12. }
  13. $title = implode(', ', $cat_titles) . $separator . $title;
  14. }
  15.  
  16. return $title;
  17. }
  18. add_filter('the_title', 'tribe_events_title_include_cat', 100, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement