Okay
  Public Ticket #3199061
Default event description
Closed

Comments

  •  1
    seotijger started the conversation

    I have imported F1 races with an ICS file.

    However there is no description in the ICS file for the events.

    I would really like to insert a default description for all the events, so that it is not so empty.

    Is there any way to achieve this easier than editing every single event to copy paste a description inside?

    Hope to hear from you!

    Thanks!

    Jeffrey


  •  877
    Zhivko replied

    Hi,

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

    add_filter('stec_event_get_front_data', function($data) {
        if (!$data['description']) {
    
                    $data['description'] = 'My generic description here';     }     return $data;
    });
    9841591472.png



    Stachethemes Developer

  •  1
    seotijger replied

    Thank you very much, I'm going tot make a child theme and than add it to the functions file.

    Thanks!

  •  1
    seotijger replied

    Thank you, the code works perfectly.

    Another question can I also make a default image for the event with such a piece of code?

    And why is there no date and time in the pop-up information? See screenshot

    Attached files:  event-popup.png

  •  877
    Zhivko replied

    Updated filter:

    add_filter('stec_event_get_front_data', function($data) {
        
        if (!$data['description']) {
                $data['description'] = 'My generic description here';
        }     if (!$data['images']) {         $data['images']      = array(0);
            $data['images_meta'] = array(
                array(
                    "id"          => 0,
                    "alt"         => "",
                    "caption"     => "",
                    "description" => "",
                    "src"         => "https://url-to-image", // fill this
                    "thumb"       => "https://url-to-image-thumb", // fill this
                    "title"       => ""
                )
            );
        }     return $data;
    });

    The popup don't have date and time yes... I'll be updating the calendar this week and will make sure to add them.


    Stachethemes Developer