• Resolved paulbigelow

    (@paulbigelow)


    I’d like to suggest that a category class be added for events. That would allow CSS customization based on the category. I change the background colour of an event title based on the category, to help viewers distinguish between types of events.

    It may not be the best of code, but here’s what I use (a patch to 1.4.1):

    243c243,251
    < 				$event_output .= apply_filters( 'ecs_event_start_tag', '<li class="ecs-event">', $atts, $post );
    ---
    >  				$category_class = "";
    >  				$category_list = get_the_terms($post, 'tribe_events_cat');
    >  				$category_slug = $category_list[0]->slug;
    >  				if ($category_slug) {
    >  					$category_class = ' ' . $category_slug . '_event';
    >  				}
    >  
    > 
    > 				$event_output .= apply_filters( 'ecs_event_start_tag', '<li class="ecs-event' . $category_class . '">', $atts, $post );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Brian Hogg

    (@brianhogg)

    Thanks for the suggestion and patch! I’ll review and see if it can be included, perhaps looping through all the category terms and adding them rather than just the first one (if there’s more than one).

    Plugin Author Brian Hogg

    (@brianhogg)

    A note that something similar to this has been added into version 1.4.2, where all categories (if any) are added as classes with _ecs_category added on the end.

    Thanks for the suggestion!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Suggestion – category class’ is closed to new replies.