-
-
Save danieliser/32aff18fbf245c58c7fe to your computer and use it in GitHub Desktop.
<?php | |
function my_custom_popup_trigger( $is_loadable, $popup_id ) { | |
if ( $popup_id == 123 ) { | |
if ( $my_condition == true ) { | |
$is_loadable = true; | |
} | |
else { | |
$is_loadable = false | |
} | |
} | |
return $is_loadable; | |
} | |
add_filter( 'popmake_popup_is_loadable', 'my_custom_popup_trigger', 1000, 2 ); |
Updated to deal with missing argument issue.
Hi,
With latest version 1.4.5, if I have use filter to set condition and trigger, I still need to set condition and trigger in popup or ignore it?
function user_logged_in_trigger( $is_loadable, $popup_id ) { if ( is_page( 8 ) ) { if ( is_user_logged_in() ) { if ( $popup_id == '194' ) { $is_loadable = true; } } else { if ( $popup_id == '195' ) { $is_loadable = true; } } } return $is_loadable; } add_filter( 'popmake_popup_is_loadable', 'user_logged_in_trigger', 1000, 4 );
@elvinlee - You may still want to add page level targeting but if you want it sitewide then no you don't need conditions.
But the filter above only applies to conditions not triggers so you still need to add your triggers to open it the way you want.
on WP 4.3.1, plugin version 1.9 is showing:
Warning: Missing argument 2 for popup_trigger()
also, the else is not closed with ;