How to display Convert Plus specific popup if some URL parameters are set?

Convert Plus allows you to display or hide Specific Popups as per your URL parameters.

In order to proceed, first, you need to create a new popup for your specific language.

You will need the things mentioned below:

  • Your style ID – You can find it here in your style customizer screen –  http://goo.gl/EOXUlD
  • Your URL parameter – Retrive URL 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 );

Leave a Comment

Your email address will not be published. Required fields are marked *