Fixing Displet Pop Plugin For WordPress/W3TC

  • Posted on: 29 October 2014
  • By: davis

Pop-ups are great for business. That much is a simple fact of life in Internet marketing. Pop-ups reduce your bounce rate, engage readers, and increase subscription rates. If you are a Wordpress site developer, you may have looked for a simple pop-up plugin that simply works.

Displet Pop is a Wordpress plugin designed to present users with a pop-up after a certain level of engagement (typically, after visiting 5 pages). For marketing purposes, we want the ad to appear immediately. Luckily, Displet allows a base level of customization.

Here's the problem: If you are running W3TC (W3 Total Cache), you most likely want to take advantage of the Minify feature. Unfortunately, the Minify feature of W3TC breaks the Displet plugin, displaying it either at the bottom of the page, or simply not rendering it.

The Solution

Displet's pop-ups use a stylesheet named style.css. This file breaks when Minified or combined with your site's style.css. Therefore, our first step is to rename the stylesheet (I chose popstyle.css) The stylesheet is referenced in displet-pop.php

function displetpop_scripts() {
wp_enqueue_script('jquery');
wp_register_script( 'jquery-cookie', plugins_url('jquery.cookie.js', __FILE__) );
wp_enqueue_script( 'jquery-cookie', array('jquery') );
wp_register_style( 'style', plugins_url('style.css', __FILE__) );
wp_enqueue_style( 'style' );
}

As you can see, we need to modify references to style.css, as I have done below.

function displetpop_scripts() {
wp_enqueue_script('jquery');
wp_register_script( 'jquery-cookie', plugins_url('jquery.cookie.js', __FILE__) );
wp_enqueue_script( 'jquery-cookie', array('jquery') );
wp_register_style( 'popstyle', plugins_url('popstyle.css', __FILE__) );
wp_enqueue_style( 'popstyle' );
}

For convenience, I have uploaded an updated Displet plugin HERE. Install in Wordpress as usual.

Now, in your W3TC panel, click on "Minify." Scroll near the bottom and make the following entry.

Never minify the following JS files: http://****.com/wp-content/plugins/displet-pop/jquery.cookie.js?ver=4.0

Save all of your settings, empty the page cache, and you are all set! Enjoy your updated Displet Pop plugin.

P.S. Feel free to set the Minify JS settings to "Non-blocking using async" without fear of the plugin breaking. This will improve load performance (use Google's PageSpeed Insights tool to benchmark your site's performance)