• Hey guys,

    I currently have a couple plugins that I would like to remove from all pages that use a specific template I made. The template I made is basically a “blank” template that only shows the page contents and some very minimal styling. Because this template was design to be loaded inside of an iframe, I dont want certain plugins loading on my page twice (once on the main page and again inside the iFrame).

    The template name is “Blank Template” (file name: template-blank.php)

    So here is the script that I created to place in the functions.php file that works exactly as intended, except it’s not conditional, it removes this chat plugin from ALL pages:

    function removeChat() {
    wp_deregister_script( 'push2call_script_client' );
    }
    add_action( 'wp_print_scripts', 'removeChat', 100 );

    Now, where I am running into problems is when I try to make it condition based on the template. Here is one of many attempts I’ve made:

    function removeChat() {
    wp_deregister_script( 'push2call_script_client' );
    }
    if ( is_page_template('template-blank.php') ) {
    add_action( 'wp_print_scripts', 'removeChat', 100 );
    }

    Can anyone tell me what I am doing wrong? I cant for the life of me figure this out, and I am about to rip my hair out! 🙂 Thanks guys!

    My website is at http://www.ac-mn.com/wordpress

  • The topic ‘Remove Plugin Depending on Page Template Used’ is closed to new replies.