add_action('stec_after_insert_event', function ($result, $event, $is_update) {
if ($is_update) { return; // do nothing if is update }
wp_update_post(array( 'ID' => $event->get_id(), 'comment_status' => 'open', 'meta_input' => array( 'comments' => 1
) ));
}, 10, 3);
This will make sure to open comments regardless of the admin settings ONLY when you create the event for the first time meaning you can close the comments if you update the event afterwards.
The hook should be placed in your theme or child-theme functions.php file.
Dear Zhivko,
is it possible to set in every event two options as default:
Under STEC > Events > Edit Event > Tab General: There I want to have the options "Counter" and also "Comments" set as default active.
Until now I have to set both options manually on active at every new entry.
Thanks in advance,
Vincent
You could use this hook:
This will make sure to open comments regardless of the admin settings ONLY when you create the event for the first time meaning you can close the comments if you update the event afterwards.
The hook should be placed in your theme or child-theme functions.php file.
Stachethemes Developer
Thank you, Zhivko.
Is that also working for the Counter? I think this code is for the comments only?
With "Counter" I mean the count down of the days remaining until the event happens. See screenshot attached.
Thanks again,
Vincent
Sorry... here's updated code.
Stachethemes Developer
Dear Zhivko,
it works perfekt. Thanks a lot.
This ticket can be closed.
Really nice and also fast support. Thanks for that!
Vincent