• Resolved Okoth1

    (@okoth1)


    Hello,

    I want to load the plugin only on the page that has the subscribe button. Would it be possible to hook into this?

    function dequeue_email_subscribers() {
    if (!is_page(‘subscribe-now’)) {
    wp_dequeue_script(’email-subscribers-script-handle’);
    wp_dequeue_style(’email-subscribers-style-handle’);
    }
    }
    add_action(‘wp_enqueue_scripts’, ‘dequeue_email_subscribers’, 100);

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Shubhanshu Kandani

    (@shubhanshukandani)


    Hi @okoth1 ,

    Thanks for contacting us and are delighted to assist you.

    I suggest utilizing the following PHP code snippet to conditionally load Express.js and CSS:

    function dequeue_email_subscribers() {
        if (!is_page('subscribe-now')) {
            wp_dequeue_style('email-subscribers');
            wp_dequeue_style('ig-es-popup-frontend');
            wp_dequeue_style('ig-es-popup-css');
            wp_dequeue_script('email-subscribers');
            wp_dequeue_script('ig-es-pre-data');
            wp_dequeue_script('ig-es-popup-js');
        }
    }
    add_action('wp_enqueue_scripts', 'dequeue_email_subscribers', 100);

    You can use the above code into the functions.php file of your currently active child theme or use the “Code Snippets” plugin for easy integration.

    Let me know how it goes on your side.

    Cheers!

    Thread Starter Okoth1

    (@okoth1)

    @shubhanshukandani

    This works in Xampp. The code only loads on the page that has the subscribe button. I have tested it on a live site with subscribing, but I assume it will work.

    Thank you for providing a solution again.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Only on the page that has the subscribe button’ is closed to new replies.