Home › Forums › Calendar Products › Events Calendar PRO › Event Color by Category Theming
- This topic has 3 replies, 3 voices, and was last updated 12 years ago by
Casey.
-
AuthorPosts
-
March 14, 2014 at 8:11 am #118831
Damon
ParticipantHi all,
I am trying to figure out how to grab the category name or id so that I can change the color with an if statement in the single-event.php page. I have been able to do some theming in it otherwise, so I know I have the file in the right place in my theme folder.
I was hoping to be able to simply populate a variable with the information, so I could put it in an attribute (depending on the category). For example, I was thinking if I had a Dining event, I could make it red and if I had a Golf event, I could make it green, just by calling the correct variable into . It seems like it should be an easy thing to do, but it is outwitting me. (I was thinking I would put my if statement to populate the $variable_for_color in the variables area after global $post (which is line 18 of single-event.php). Please tell me if that’s not the right place for it.)
This is a long way of me asking this: Is there a variable that has this information in it already? If not, how do I get it? I have been scouring the forums, and I haven’t found anything to help. Also, I didn’t want to install the third-party Events Calendar Category Colors plug-in, because it doesn’t really do what I want it to.
Thanks very much,
–Damon.
March 14, 2014 at 1:07 pm #118972Casey
ParticipantDamon,
Thanks for getting in touch! The best method to do style up a specific category single page, would be to use the body_class(). Try pasting the following snippet into your theme’s functions.php file: https://gist.github.com/ckpicker/9555637After doing this, you’ll notice that now Category CSS classes get added to the <body> tag of your single event page (ex: tribe-events-cat-arts-culture). This should help you with styling specific categories with different colors.
Also, you might want to take a look at this unofficial, third-party plugin, which allows you to customize colors based on event categories as well: http://wordpress.org/plugins/the-events-calendar-category-colors/
Hopefully that gets you pointed in the right direction, but let me know if you need further help. Thanks! 🙂
-Casey-
March 14, 2014 at 2:50 pm #119007Andy Fragen
ModeratorDamon, is there something specific about The Events Calendar Category Colors plugin that isn’t working for you? It seems like it should do exactly as you need. Try it. Let me know what doesn’t work or if you have questions.
Andy
March 17, 2014 at 12:08 pm #119871Casey
ParticipantThanks for confirming that this got you sorted. Since it looks like you’re all set, I’m going to mark this thread “Answered” and close it out.
By the way, if you have a minute or two, we would love it if you’d write a few words for us here: http://wordpress.org/support/view/plugin-reviews/the-events-calendar?filter=5
Thanks in advance. 🙂
Cheers,
Casey -
AuthorPosts
- The topic ‘Event Color by Category Theming’ is closed to new replies.
