Okay
  Public Ticket #2755512
Define colors per Organizer
Closed

Comments

  •  2
    saleswizardbv started the conversation

    Hey guys, 

    I was wondering if it would be possible to link colors to certain Organizers. F.e. if an event (that gets created) involves Organizer #1, the color of the event should change accordingly. Same with other organizers. 

    Would this be possible with your plugin? Thanks in advance! 


  •  776
    Zhivko replied

    Hi,

    You could do it via a filter.

    In your theme or child-theme add following:

    add_filter('stec_event_get_front_data', function ($data) {
        $COLORS_BY_ORGANIZER = [
            1001 => '#5d88d9',
            1002 => '#e64337',
            // etc...
        ];     if ($data['organizers']) {
            foreach ($data['organizers'] as $organizer) {
                if (isset($COLORS_BY_ORGANIZER[$organizer->id])) {
                    $data['color'] = $COLORS_BY_ORGANIZER[$organizer->id];
                    continue;
                }
            }
        }     return $data;
    });

    You will have to alter the COLORS_BY_ORGANIZER array where 1001 for example is the organizer id following by desired event color.


    Stachethemes Developer

  •  2
    saleswizardbv replied

    Also this works greatly, zhivko. 

    Thank u a lot!