{"id":22586,"date":"2018-07-20T19:30:09","date_gmt":"2018-07-20T14:00:09","guid":{"rendered":"http:\/\/convertplug.com\/plus\/?post_type=docs&#038;p=22586"},"modified":"2018-07-25T14:52:49","modified_gmt":"2018-07-25T09:22:49","slug":"show-or-hide-convert-plus-module-if-specific-url-parameters-are-set","status":"publish","type":"docs","link":"https:\/\/convertplug.com\/plus\/docs\/show-or-hide-convert-plus-module-if-specific-url-parameters-are-set\/","title":{"rendered":"How to Show or Hide Convert Plus Module if Specific URL parameters are set?"},"content":{"rendered":"<p><highlight>Available from version 3.3.2<\/highlight><\/p>\n<p>Convert Plus allows you to display or hide Specific Popups depending on the URL parameters set.<\/p>\n<p>In order to proceed, first, you need to create a new popup for this purpose.<\/p>\n<p>You will need the things mentioned below:<\/p>\n<ul>\n<li>Your style ID &#8211; You have two ways to look up to your style ID in Convert Plus. <a href=\"http:\/\/convertplug.com\/plus\/wp-content\/uploads\/sites\/4\/2017\/09\/Style-ID.jpg\" target=\"_blank\" rel=\"noopener\">Screenshot one<\/a> or <a href=\"http:\/\/convertplug.com\/plus\/wp-content\/uploads\/sites\/4\/2018\/06\/Style-ID-seen-in-Convert-Plus.jpg\" target=\"_blank\" rel=\"noopener\">Screenshot two<\/a><\/li>\n<li>Your URL parameter &#8211; RetrieveURL parameter using $_GET attribute. For Eg. $_GET[&#8216;param1&#8217;]<\/li>\n<\/ul>\n<p>Add below code to your theme&#8217;s functions.php file,<\/p>\n<p>1) Example to display Popup A if param1 is present in your page URL.<\/p>\n<pre class=\"lang:php decode:true \">function cp_callback_function( $display, $style_id ) {\r\n     \r\n    if( $display ) {\r\n        \/\/ Replace style id with your style ID\r\n        if( $style_id == 'cp_id_75944' ) {\r\n     \r\n            \/\/ get URl parameter.\r\n            $parameter1 = isset( $_GET['param1'] ) ? $_GET['param1'] : '';\r\n                \r\n            \/\/ Custom code.\r\n            if( $parameter1 ){                \r\n                $display = true;\r\n            }else{\r\n                $display = false;\r\n            }  \r\n\r\n        }\r\n    } \r\n \r\n    return $display;\r\n}\r\nadd_filter( 'cp_target_url_settings', 'cp_callback_function', 10, 3 );<\/pre>\n<p>2) Example to hide Popup A if param1 is present in your page URL.<\/p>\n<pre class=\"lang:php decode:true \">function cp_callback_function( $display, $style_id ) {\r\n     \r\n    if( $display ) {\r\n        \/\/ Replace style id with your style ID\r\n        if( $style_id == 'cp_id_75944' ) {\r\n     \r\n            \/\/ get URl parameter.\r\n            $parameter1 = isset( $_GET['param1'] ) ? $_GET['param1'] : '';\r\n                \r\n            \/\/ Custom code.\r\n            if( $parameter1 ){                \r\n                $display = false;\r\n            }else{\r\n                $display = true;\r\n            }  \r\n\r\n        }\r\n    } \r\n \r\n    return $display;\r\n}\r\nadd_filter( 'cp_target_url_settings', 'cp_callback_function', 10, 3 );<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Available from version 3.3.2 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 &#8211; You have two ways to look up to your [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":0,"template":"","meta":{"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"docs_category":[],"docs_tag":[],"class_list":["post-22586","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/docs\/22586","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/users\/12"}],"version-history":[{"count":0,"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/docs\/22586\/revisions"}],"wp:attachment":[{"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/media?parent=22586"}],"wp:term":[{"taxonomy":"docs_category","embeddable":true,"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/docs_category?post=22586"},{"taxonomy":"docs_tag","embeddable":true,"href":"https:\/\/convertplug.com\/plus\/wp-json\/wp\/v2\/docs_tag?post=22586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}