Home › Forums › Calendar Products › Events Calendar PRO › Event category classes in Events List Widget
- This topic has 8 replies, 4 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 18, 2013 at 9:28 am #55882
fenoco
ParticipantHi,
I was wondering if it was possible to edit the list widget’s template so it adds the corresponding classes to the event element . I need to color code the events on the list by their category. I tried adding to the attribute in the element but it prints out nothing.
Any thoughts? Thanks in advance.
July 18, 2013 at 7:16 pm #56024reid peifer
MemberHi Fenoco
Super cool looking site that you’re working on. There is an override system in place so you can write your own versions of the views without editing the core plugin directly.Go to your theme folder make a new them called tribe_events. In tribe_events make another folder called widgets. Now you want to copy the list widget file into that folder.
Go to the plugin folder > views > widgets and copy list-widget.php and paste it into the new widgets folder you’ve created. So when you’re done you should have
yourtheme > tribe-events > widgets > list-widget.phpNow we just need to modify the template to print out the categories within the class attribute.
This code gist should do the trick: https://gist.github.com/reidpeifer/6034586July 18, 2013 at 7:18 pm #56027reid peifer
MemberHey Fenoco – Note: There was a typo in the above comments. I have fixed it, but make sure that you title the new folder tribe-events and NOT tribe_events
July 19, 2013 at 7:08 am #56067fenoco
ParticipantHi Reid! Thanks for your comment, and your answer. We were aware of the override system, and we are using it. It’s great that you thought of that.
We actually figured something out after creating the discussion so I’ll post it here for reference. We ended up doing this:
ID, 'tribe_events_cat' );
$term = array_pop($terms);
/* foreach ($terms as $elterm) { echo $elterm->slug.' ' ; } */
?>
<li class="slug; ?> cf"> Your event goes here.
Works wonders. Thanks again!July 19, 2013 at 7:10 am #56069fenoco
Participanthmm… The code came up all wrong. This is it:
—
ID, ‘tribe_events_cat’ );
$term = array_pop($terms);
/* foreach ($terms as $elterm) { echo $elterm->slug.’ ‘ ; } */
?>
<li class="slug; ?> cf”>
—July 19, 2013 at 7:54 am #56079reid peifer
MemberSo glad you got it working. Thanks for sharing your solution.
July 30, 2013 at 10:18 am #57796fenoco
ParticipantActually this is the code:
$terms = get_the_terms( $post->ID, ‘tribe_events_cat’ );
$term = array_pop($terms);Then you can echo $term->slug; wherever you need.
August 1, 2013 at 3:41 pm #58410Rob
MemberThanks for the follow-up, fenoco. I’ve marked your newest reply as the answer 🙂
It sounds like you’re all set for now, but if you do need anything down the road, don’t hesitate to let us know. Going to close out this thread though.
July 7, 2015 at 6:27 am #979742Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Event category classes in Events List Widget’ is closed to new replies.
