- How to Install Convert Pro Addons?
- Understanding the General Settings of Convert Pro
- Understanding the Email Notification Settings in Convert Pro
- How to Create a Modal Popup in Convert Pro?
- Configuration Settings for a Modal Popup in Convert Pro
- How to Display a Call-to-action on a Specific Page, Post, Category etc (Page Level Targeting)?
- How to Target Users based on the Device they use?
- Schedule Your Call-to-action in Convert Pro
- What is a Call-to-Action in Convert Pro? How can I create one?
- Shortcut Keys For Customizer Operations
- Google Analytics Integration with Convert Pro
- How to Setup Convert Pro Events in Google Tag Manager
- Understanding the Email Notification Settings in Convert Pro
- How to A/B Test Two or More Call-to-Actions in Convert Pro?
- How to Add Custom CSS/HTML code/shortcode to a Call-to-action in Convert Pro?
- How to Create a Language Specific Popup in Convert Pro?
- Introduction to Rules sets in Launch settings of Convert Pro
- How to Integrate an Elementor Form in a Convert Pro call-to-action?
- How to Disable Click Event for a text?
- What are the Field actions in Convert Pro?
- Designing a Call-to-action in Convert Pro
- Cookie Settings in Convert Pro
- How to Create an Infobar in Convert Pro?
- How to Create a Full Screen Popup or Call-to-action in Convert Pro?
- How to Edit a Call-to-action in Mobile View?
- How can I disable a Call-to-action on Mobile Devices?
- How to Rename a Call-to-action in Convert Pro?
- How to Display a Call-to-action when a Specific Product is Added to the Cart?
- Working with Referrer Detection in Convert Pro
- Show or Hide Call-to-action to Logged in and First time users
- How can I disable a Call-to-action on Mobile Devices?
- How to Disable Google Fonts in the Frontend?
- How to Target Users based on the Device they use?
- Filter to Add a New Custom Font
- Convert Pro Email Notification Filters
- Google Analytics Integration with Convert Pro
- How to Integrate Convert Pro with ActiveCampaign?
- How to Integrate Convert Pro with ConvertKit?
- How to Integrate Convert Pro with AWeber?
- How to Integrate Convert Pro with Benchmark Email?
- How to Integrate Convert Pro with Campaign Monitor?
- How to Integrate Convert Pro with Campayn?
- How to Integrate Convert Pro with CleverReach?
- How to Integrate Convert Pro with Constant Contact?
- How to Add a New Google Font?
- How to Add Custom Conditions to Display a Call-to-action?
- How to Change the Credit Link Text?
- How to Display a Call-to-action when a Specific Product is Added to the Cart?
- How to Trigger a Call-to-action only on Woo-commerce order received page?
- How to Use the Advanced Script Addon in Convert Pro?
- How to Clear Cache for Call-to-Actions in Convert Pro?
- How to Create a Language Specific Popup in Convert Pro?
- How to White Label Convert Pro?
- How to Pass Current Page URL as a Value to Hidden Field of the Form?
- Filter to Add a New Custom Font
- Authenticate your MailChimp Account
- Authenticate your Benchmark Email Account
- Authenticate your ActiveCampaign Account
- Authenticate your Campaign Monitor Account
- Authenticate Your CleverReach Account
- Authenticate Your ConvertKit Account
- Authenticate your GetResponse Account
- Authenticate Your MailerLite Account
- Drip API Token
- How to Trigger a Welcome Popup or Opt-in with Convert Pro?
- How to Trigger an After Scroll Call-to-Action with Convert Pro?
- How to Trigger a Popup when a User is About to Leave the Page (Exit Intent)?
- How to Trigger a Call-to-action only on Woo-commerce order received page?
- How to Trigger a Popup on User Inactivity (User Inactivity Trigger)?
- How to Trigger a Popup or Call-to-action on Click of an Element/Button?
- Trigger a Call-to-Action using a Link Code
- Trigger a Call-to-Action using a Unique CSS class or ID (Button and WordPress Menu Item)
- How to Trigger a Call-to-Action after a Blog Post?
How to Add Custom Conditions to Display a Call-to-action?
Description
The cp_pro_target_page_settings filter allows adding custom conditions to display your design.
Usage
/** * Callback function to add more conditions while displaying popup * * @param bool $display * @param string $style_id * @return bool $display */ function your_callback_function( $display, $style_id ) { // Replace style id with your style ID if( $style_id == '23' ) { // your custom logic } return $display; } add_filter( 'cp_pro_target_page_settings', 'your_callback_function', 10, 3 );
Parameters
- $display: (bool) value for displaying popup
- $style_id: ( Int ) ID of style
Example
/** * Display style only to users with author role */ function check_user_role( $display, $style_id ) { // Replace style id with your style ID if( $style_id == '18' ) { if( is_user_logged_in() ) { // get current user role $current_user = new WP_User(wp_get_current_user()); $user_roles = $current_user->roles; if( in_array( "author", $user_roles ) ) { $display = true; } else { $display = false; } } else { // hide style for non logged in users $display = false; } } return $display; } add_filter( 'cp_pro_target_page_settings', 'check_user_role', 10, 3 );
Was this doc helpful?
What went wrong?
We don't respond to the article feedback, we use it to improve our support content.
On this page