Home › Forums › Ticket Products › Event Tickets Plus › show category in event title
- This topic has 6 replies, 3 voices, and was last updated 9 years, 7 months ago by
Pau.
-
AuthorPosts
-
September 6, 2016 at 9:08 am #1160417
Pau
ParticipantDear TECPRO,
I would like to show the category (and category colour) on the Event Title
Currently, I’m showing title / date / venue / city
I would like to add category
I know I have to edit all the php files and so, the question is: which snippet of code do I need to use to ‘call’ the category?
many thanks as usual
September 6, 2016 at 9:27 am #1160430Geoff
MemberHey Pau, nice to see you and I hope all is well .:)
We actually have a post that provides step-by-step instructions for adding the category of an event to the event title:
https://theeventscalendar.com/knowledgebase/add-category-prefix-to-event-titles/
Try using that and see if it at least helps get you started. π
Cheers!
GeoffSeptember 6, 2016 at 10:04 am #1160510Pau
ParticipantHi Geoff, how are you?
This is great, exactly what I need
Unfortunately, either I paste this on the wrong place or the code is not good
it comes with an error, and when tried the site crashed (I did back up, so all saved again)
This is the code:
<?php // Prepends category name(s) to the event titles function tribe_events_title_include_cat ($title, $id) { $separator = ' » '; // HTML Separator between categories and title $cats = get_the_terms($id, 'tribe_events_cat'); $is_ajax = defined('DOING_AJAX') && DOING_AJAX; $is_truly_admin = is_admin() && !$is_ajax; if (tribe_is_event($id) && $cats && !is_single() && !$is_truly_admin) { $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);on Dreamweaver (yes, I know!) says 1st line is wrong…
any suggestions ( or how should i paste this on the functions.php?
Thanks for patience again
πSeptember 6, 2016 at 3:53 pm #1160705Geoff
MemberOh shoot so sorry about that Pau!
Will you please try removing the first line from the snippet? That <?php code may not be necessary in theΒ functions.php file.
Thanks!
Geoffp.s. No hate on dreamweaver! In fact, the preview of the next release looks pretty sweet. π
September 6, 2016 at 4:31 pm #1160721Pau
ParticipantOh, the joy!
thanks
xSeptember 7, 2016 at 7:10 am #1160894Geoff
MemberMy pleasure! Have a great day. π
-
AuthorPosts
- The topic ‘show category in event title’ is closed to new replies.
