Convert Plus allows you to display or hide Specific Popups depending on the URL parameters set.
In order to proceed, first, you need to create a new popup for this purpose.
You will need the things mentioned below:
- Your style ID – You have two ways to look up to your style ID in Convert Plus. Screenshot one or Screenshot two
- Your URL parameter – RetrieveURL parameter using $_GET attribute. For Eg. $_GET[‘param1’]
Add below code to your theme’s functions.php file,
1) Example to display Popup A if param1 is present in your page URL.
function cp_callback_function( $display, $style_id ) {
if( $display ) {
// Replace style id with your style ID
if( $style_id == 'cp_id_75944' ) {
// get URl parameter.
$parameter1 = isset( $_GET['param1'] ) ? $_GET['param1'] : '';
// Custom code.
if( $parameter1 ){
$display = true;
}else{
$display = false;
}
}
}
return $display;
}
add_filter( 'cp_target_url_settings', 'cp_callback_function', 10, 3 );
2) Example to hide Popup A if param1 is present in your page URL.
function cp_callback_function( $display, $style_id ) {
if( $display ) {
// Replace style id with your style ID
if( $style_id == 'cp_id_75944' ) {
// get URl parameter.
$parameter1 = isset( $_GET['param1'] ) ? $_GET['param1'] : '';
// Custom code.
if( $parameter1 ){
$display = false;
}else{
$display = true;
}
}
}
return $display;
}
add_filter( 'cp_target_url_settings', 'cp_callback_function', 10, 3 );