Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Prepends category name(s) to event titles
- function tribe_events_title_include_cat ($title, $id) {
- $separator = ' » '; // Separator between categories and title
- $cats = get_the_terms($id, 'tribe_events_cat');
- if (tribe_is_event($id) && $cats && !is_single()) {
- $cat_titles = array();
- foreach($cats as $i) {
- $cat_titles[] = $i->name;
- }
- $title = implode(', ', $cat_titles) . $separator . $title;
- }
- return $title;
- }
- add_filter('the_title', 'tribe_events_title_include_cat', 100, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement