I spent the better part of the weekend burning on Candied Pop writing a couple of articles and re-posting some of my reviews from here–bootstrap content–but mainly I’ve been tightening up the technical aspects of the site. It is the first time I’ve worked with ad content so I’ve been operating on a bit of a learning curve trying figure out the best mix and arrangement of individual items.
One of the things I looked into doing was having some of the ads rotate through a pre-determined set, mostly the Amazon ones, so I looked around for plugins that would do the trick. I couldn’t get CG-Amazon nor AdRotator to work, the former threw errors when activated and the other, well, no errors but it just didn’t work as advertised. In the midst of my head scratching I stumbled upon a plugin, Witty, that serves up quotes from a file. It worked right out of the box but it only works with a single file which doesn’t quite what I needed, so a little code tweaking and I have a plugin that works like I need.
Here’s the code in question:
function witty ($before = ”, $after = ”) {
$file_path = “witty.txt”;
$witty_file = (ABSPATH . “wp-content/” . $file_path);
And the tweak I applied:
function witty ($file = ”, $before = ”, $after = ”) {
$file_path = $file;
$witty_file = (ABSPATH . “wp-content/” . $file_path);
Wicked simple tweak which allows us to reuse the plugin anywhere on the page with multiple ad files. The curious thing of it is that this code is pretty similar to AdRotator but for some reason the latter did not read the file. Never no mind as we now have a solution for dynamic ads.


