• Resolved w-sky

    (@w-sky)


    Hello, is it possible to add the integration code and the prompt for SendPulse notification only on one page of my site?

    Getting the prompt everywhere is a bit too intrusive, that’s some feedback I received. Since I also need to have the cookie banner, I would like to have SendPulse’s prompt only on a subscription page.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author SendPulse

    (@sendpulse)

    Hello! Sorry for the late response. Yes. We can make prompt only on a subscription page.

    You can add this code at your functions.php file inside your theme (/wp-content/theme/theme_name/functions.php)

    // Disable the original sendpulse_display() function for all pages
    remove_action('wp_head', 'sendpulse_display', 1000);
    remove_action('login_enqueue_scripts', 'sendpulse_display');
    
    // Define the custom_sendpulse_display() function with the modified logic
    function custom_sendpulse_display() {
        $page_id = get_queried_object_id();
        // Replace with actual page ID or ID's. It can be like that if you need more than 1 page to show Push Message $target_page_ids = array(2,3); 
        $target_page_ids = array(2); 
    
        if (in_array($page_id, $target_page_ids)) {
            $html = get_option('sendpulse_code', '');
            echo $html;
        }
    }
    
    // Enqueue the custom_sendpulse_display function on the appropriate action hooks
    add_action('wp_head', 'custom_sendpulse_display', 1000);
    add_action('login_enqueue_scripts', 'custom_sendpulse_display');
    • This reply was modified 1 year, 2 months ago by SendPulse.
    Thread Starter w-sky

    (@w-sky)

    Thanks! I found another solution by inserting the SendPulse script code directly into the page with a HTML block in WordPress editor. Seems to work fine.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Have prompt and integration code only on one page?’ is closed to new replies.