Last active
May 14, 2018 18:15
-
-
Save danieliser/32aff18fbf245c58c7fe to your computer and use it in GitHub Desktop.
Custom Targeting using popmake_popup_is_loadable filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Updated to deal with missing argument issue.