Okay
  Public Ticket #3139417
Email Template Tags
Closed

Comments

  •  2
    Marko Bilandzija started the conversation

    Hi, I was wondering if there was any documentation of the email template tags that I can reference. For example, in some of them, you use {{title}} and {{start_date}} to populate certain fields dynamically.

    Is there documentation for all available tags that I can use. We're just trying to spruce up our emails that go out and would like to show things like the start time of the event as well and any other potential tags.

    Please advise. Thank you.

  •  783
    Zhivko replied

    Hi,

    There's a filter that allows to add extra placeholders. 

    9120584197.png


    /**
     * This example adds {{end_date}} and {{event_color}} placeholders
     * 
     * $filter the array that is returned containing all placeholders
     * $text the text that is being processed
     * $event the event object ( @see assets\php\o.event.php )
     */
    add_filter('stec_mail_add_special_words', function ($filter, $text, $event) {
        $filter['replace'][] = '{{end_date}}';
        $filter['with'][]    = $event->get_end_date();
        $filter['replace'][] = '{{event_color}}';
        $filter['with'][]    = $event->get_color();
        return $filter;
    }, 10, 3);
    

    Are you looking for a specifc data?


    Stachethemes Developer

  •  2
    Marko Bilandzija replied

    It would just be nice to know what's available to use. Right now the main requests are to be able to share the date and time of the event in the email that goes out but they may want some other fields. There was nothing in the documentation and it would be really beneficial if it was in there.

  •  783
    Zhivko replied

    There are no ready to use special words that aren't already in use in the default templates.

    I've intentionally left a filter there in case extra dynamic data needs to be inserted.


    Stachethemes Developer

  •  2
    Marko Bilandzija replied

    Ah I see,

    I just don't really understand the filter part that you mentioned earlier and how to set that up properly. It would be nice to be able to show the date and time for the class in that email template when they get the RSVP notification.

  •  783
    Zhivko replied

    Place this filter in your theme or child-theme functions.php file:

    add_filter('stec_mail_add_special_words', function ($filter, $text, $event) {
        $filter['replace'][] = '{{event_date}}';
        $filter['with'][]    = $event->get_start_date('d. F. Y');     $filter['replace'][] = '{{event_time}}';
        $filter['with'][]    = $event->get_start_date('h:i a');     return $filter; }, 10, 3);

    Then you should be able to use {{event_date}} and {{event_time}} to display the event start date and the start time.

    E.g. 

    The event start on {{event_date}} at {{event_time}}. 

    Stachethemes Developer