How To use the Banner-Plugin AdRotate together with W3 Total Cache’s Page-Cache (W3TC)
W3 Total Cache is one of many plugins out there to speed up your wordpress website.
Due to the „Page Cache“ no PHP, WordPress oder MySQL is needed…all documents are „pre-compiled“ and ready to be served to the user. This increases the speed of a „page-cache-driven“ website dramatically. Great feature.
Even if W3 Total Cache offers solutions using „fragmented caching“ (all shown examples didn’t work well with AdRotate), the developers of AdRotate told us quite clearly: Adrotate doesn’t work with caching Plugins!
Important advice concerning Ad Impressions: On every page load, every ad banner will be loaded, even if just one banner at once appears on the screen. The consequence is that ad impression statistic isn’t useful anymore (if you’re interested in ad impression statistics, you have to switch to another solution)
The problem: Page Cache creates static documents and all AdRotate Ads will stop rotating.
Our tool: JQUERY Cycle! Let’s go…
1. Integrate JQUERY-Cycle-Plugin via „functions.php“
Put this code directly in your theme’s „functions.php“ file.
2. Allow PHP directly in static WordPress-Text-Widgets
Put also this piece of code in your „functions.php“ file to allow the execution of PHP directly in static Text-Widgets
3. Create a simple Text-Widget within WordPress
Just create a simple text widget. the pre-installed widgets of AdRotate can’t be used for this purpose, because just one image will be shown. We need all banners at once.
Now we have to write the output via PHP’s „echo“ directly into our Text-Widget. For our example we chose 3 rotating ads. For sure you can extend our example to show as many banners as you like (don’t forget to assign the correct ID’s of your ads – you will find them directly in your AdRotate Panel).
Save your text widget!
Concerning „timeout“ and „random“: Type in „0“ to let ads rotate on page refresh (random). Type in a higher value (milliseconds) to define the rotation-speed of your ads. Random „1“ has to be set to activate random display. This is important for balanced „ad impressions“.
Now your ads should rotate! We suggest to define fixed width and height values for your ad-zones via CSS (depending on your banner sizes) so that on page load nothing „jumps around“.
5. Turn on W3 Total Cache’s Page-Cache and you get: A faster website with rotating ads!
Magic! All ads and banners should rotate and due to the activated page-cache your website should load much faster. Great performance, combined with rotating AdRotate-Banner-Ads…that’s all folks…