trigger
-
Hi,
In admin , is it possible to set by defaul the trigger to DELAY /AUTO OPEN ?
thanks
-
Hi @pipoulito,
The short answer is no. There is no way to set a DEFAULT trigger for all newly created popups at the moment. This is to avoid inadvertently showing your popup everywhere while you’re still building it.
We hope this answers your question. Let us know if we can help you with anything else. π
Hi,
thanks, even with a hook on y side or a php trick ?
-
This reply was modified 3 years, 4 months ago by
pipoulito.
Hi @pipoulito,
We’ll forward this question to our development team if they have suggestions on how to do that in the backend. We’ll let you know once we receive feedback. π
Cheers~
@pipoulito – Are you trying to make all new popups use that trigger, or all popups in general, new and existing, use that trigger?
IE filter defaults, or filter popup settings passed to the JavaScript?
i used this
add_action('save_post', 'handle_pum_creation'); function handle_pum_creation($post_id) { $post = get_post( $post_id ); if( $post !== null && $post->post_status == 'publish' && $post->post_type == 'popup') { $popup_settings = get_post_meta( $post_id, 'popup_settings' ); $popup_settings = $popup_settings[0]; if(isset($popup_settings['triggers']) && empty($popup_settings['triggers'])){ $popup_settings['triggers'][0] = [ 'type' => 'auto_open', 'settings' => [ 'delay' => 500, 'cookie_name' => [ 0 => 'pum-'.$post_id ] ] ]; } if(isset($popup_settings['cookies']) && empty($popup_settings['cookies'])){ $popup_settings['cookies'][0] = [ 'event' => 'on_popup_close', 'settings' => [ 'name' => 'pum-'.$post_id, 'time' => '1 month', 'session' => false, 'path' => '1', 'key' => '' ] ]; } update_post_meta($post_id, 'popup_settings', $popup_settings); } }Hi @pipoulito
Thank you for your reply.
We found the same concern in our Facebook group.
The user created a custom code that allows setting the trigger Time Delay/Auto Open as the default trigger.
Here’s the code:
add_action('save_post', 'handle_pum_creation'); function handle_pum_creation($post_id) { $post = get_post( $post_id ); if( $post !== null && $post->post_status == 'publish' && $post->post_type == 'popup') { $popup_settings = get_post_meta( $post_id, 'popup_settings' ); $popup_settings = $popup_settings[0]; if(isset($popup_settings['triggers']) && empty($popup_settings['triggers'])){ $popup_settings['triggers'][0] = [ 'type' => 'auto_open', 'settings' => [ 'delay' => 500, 'cookie_name' => [ 0 => 'pum-'.$post_id ] ] ]; } if(isset($popup_settings['cookies']) && empty($popup_settings['cookies'])){ $popup_settings['cookies'][0] = [ 'event' => 'on_popup_close', 'settings' => [ 'name' => 'pum-'.$post_id, 'time' => '1 month', 'session' => false, 'path' => '1', 'key' => '' ] ]; } update_post_meta($post_id, 'popup_settings', $popup_settings); } }Reference link.
Kindly try the code and update it according to your needs.
Let us know how that goes. Thank you!
Yes it is me π
Hi @pipoulito,
Great! π Were you able to successfully set the default trigger for your popups?
Do let us know so we can mark this thread as resolved.
Thank you! π
yes thanks
-
This reply was modified 3 years, 4 months ago by
The topic ‘trigger’ is closed to new replies.