New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger popup with php #10056
Comments
Hi @wachalala Thanks for reporting. Using the shortcode doesn't mean that the popup will launch. You can add the popup to the a page based on your condition using the provided API, ex: add_action( 'wp_footer', function() {
if ( ! $CONDITION ) {
// exit and dont even print the popup
return;
}
//add the popup to the page
ElementorPro\Modules\Popup\Module::add_popup_to_location( '234' ); // 234 is the popup id
} ); Please note that you will still need to add the trigger and advanced rules if needed. Thanks |
Hello, Thank you for your fast help @shilo-ey ! I try your code but it didn't launch anything :/
Do you have any tips on that ? During my test i desactivate all my plugin and refresh with cache my page each time. Thank you :) |
Hi @wachalala You can either use Elementor conditions system, or create your own condition and register it to the conditions system. If you still want to use code: // add the popup to the page
add_action( 'wp_footer', function() {
// set popup id
$popup_id = '3955';
// insert the popup to the current page
ElementorPro\Modules\Popup\Module::add_popup_to_location( $popup_id );
?><script>
// wait for the page to load
jQuery( document ).ready( function() {
// wait for elementor to load
jQuery( window ).on( 'elementor/frontend/init', function() {
// wait for elementor pro to load
elementorFrontend.on( 'components:init', function() {
// show the popup
elementorFrontend.documentsManager.documents[<?php echo $popup_id ;?>].showModal();
} );
} );
} );
</script>;
<?php
} ); You need to trigger your popup after inserting it to your page. Thanks |
This code does not work. |
Thank you very much @shilo-ey this helps a lot. this works perfectly: but only for about one use. then the popup doesn't open anymore. I know the rest of the code is running. (I have a couple of console.log() to make sure the rest is working.) but the popup itself is not opening again.
|
@shilo-ey The code works only for admin users. The error is: Thanks |
@dabesa did you find a solution? |
I'm also struggling with this. Does someone find a solution or another way to display it? |
@dabesa For guest users it's not working... Strange things...why still no solution given for same...as i have seen same issue reported by many of them |
It's only run when we are login in admin.. |
Hello,
Since ~15 december my popup didn't appear.
I used to trigger it with php like that :
return do_shortcode( '[elementor-template id="53065"]' );
(http://prntscr.com/qisqvt)
Do you know if something change about that ?
Thank you
The text was updated successfully, but these errors were encountered: