Support » Developing with WordPress » Deactivate plugins on a Print Template

  • Resolved crillemok

    (@crillemok)


    Hi folks,
    I have a print template activated on a website, and wonder if anyone knows what I can add in the code to deactivate plugins on this template:
    http://camarsol.no/print-template/?propID=6291

    The problem is that a sticky popup is included when using the printing template, for printing.

    Can this be used:
    <?php deactivate_plugins( plugin_basename( __FILE__ ) ); ?>
    ?

    In case, should I just replace “plugin_basename” with the folder name of the plugin?
    What should “__FILE__” be replaced with?

    • This topic was modified 1 week, 4 days ago by  crillemok.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • I would suggest that you are approaching this from entirely the wrong angle!

    Most plugins add specific CSS classes, and you should use a print style sheet to hide those elements. For example, on that page the yellow popup has a class of “sticky-popup”, so your print style sheet should contain

    .sticky-popup { display: none; }

    If you don’t have a specific print style sheet you can add one to your normal styles.css, or via the Customiser, with this code around it:

    @media print {
    
    }

    What I think you need is to not display the popup when on this page, so add this to your custom css:

    .page-template-template-print .sticky-popup {
     display: none;
    }

    Thank you guys a lot for your input!
    Problem solved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.