• Resolved Matt Scheidler

    (@matt6303)


    I wish to have category-specific styling for each event displayed in agenda.twig, agenda-widget.twig and stream.twig.

    I see these being added to the div class for each event in the original templates:

    ai1ec-event-id-{{ event.post_id }}
    ai1ec-event-instance-id-{{ event.instance_id }}

    But I cannot seem to get the category ID of the event.

    I’ve tried several different things around this general concept:

    ai1ec-event-category-id-{{ event.category_id }}

    What is the proper variable, and proper syntax, that would allow me to add the event’s category to the div so that I could style each category differently?

    I can put {{ event.categories_html | raw }} into the loop item and return a link to the category – with the a tag having these classes added:

    ai1ec-category ai1ec-term-id-3 p-category

    What I’m trying to do is get ‘ai1ec-term-id-3’ added to the class on the outer div.

    Thanks for any help.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Event Category as variable in twig template’ is closed to new replies.