Plugin Support
Kim L
(@kimmyx)
Hi @soroka95,
You can check Popup Maker’s JavaScript API here for available functions your can use in your code.
We also have a guide on getting started with custom JavaScript: Getting Started With Custom JavaScript – Popup Maker Documentation
Hope this helps! Let us know if you have more questions.
Thanks for your reply, but I didn’t see there any functions to enable/disable popup. So, I need to enable/disable popup with code, not just open or close. https://prnt.sc/XaA6fx9y01XY
The code will be used in functions.php of my theme. I want to enable popup when import is going and disable popup when import is done.
/**
* Before WPAI import function
*/
function before_xml_import( $import_id ) {
// here I want to Enable popup popmake-86629
}
add_action( 'pmxi_before_xml_import', 'before_xml_import', 1, 1 );
/**
* On Complete WPAI import function
*/
function after_xml_import_function( $import_id ) {
// here I want to Disable popup popmake-86629
}
add_action( 'pmxi_after_xml_import', 'after_xml_import_function', 1, 1 );
-
This reply was modified 3 years ago by
soroka95.
-
This reply was modified 3 years ago by
soroka95.
Bel
(@belimperial)
Hi @soroka95
Thank you for your reply.
You’ll need a custom code while using some of Popup Maker’s javascript API.
As this is out of scope, you might need a developer to help you with this.
Let us know if you have any questions.
I made a solution for my case, it doesn’t enable/disable, but it changes popup status – publish/draft (Don’t forget to enable the popup once, otherwise you will not see your popup).
So if import with id 1 starts, popup 86629 is showing. If import is completed, popup changes its status to Draft.
/**
* Before WPAI import function
*/
function before_xml_import( $import_id ) {
// Check import ID
if ( (string) 1 === $import_id ) {
if( function_exists( 'pum_get_popup' ) ) {
// Check popup ID
$popup = pum_get_popup( 86629 );
if( $popup ) {
// Change popup status to Publish
$popup->post_status = 'publish';
wp_update_post( $popup );
}
}
}
}
add_action( 'pmxi_before_xml_import', 'before_xml_import', 1, 1 );
/**
* On Complete WPAI import function
*/
function after_xml_import_function( $import_id ) {
// Check import ID
if ( (string) 1 === $import_id ) {
if( function_exists( 'pum_get_popup' ) ) {
// Check popup ID
$popup = pum_get_popup( 86629 );
if( $popup ) {
// Change popup status to Draft
$popup->post_status = 'draft';
wp_update_post( $popup );
}
}
}
}
add_action( 'pmxi_after_xml_import', 'after_xml_import_function', 1, 1 );