Support this Site!
You may have noticed that there's very little third-party advertising on this site. I'd like to keep it that way. Here's how you can help:
- Buy my books. They're available at great prices on Amazon.com.
- Check out my training videos on Lynda.com. It's a great source for "all you can eat" training.
- Donate a few dollars. It'll help cover my hosting costs and give you a chance to tell me what you want to see covered here.
- Comment on blog posts. You can help get a discussion going that can benefit others, making the site more valuable for everyone.
Displaying Random Ads in Your WordPress Blog
The Goal
My goal was to be able to display small advertising images at the top of the navigation bar. The image would appear randomly from a pool of images and, when it appeared, it would be associated with a specific URL. When the image appeared, the site visitor could click the image to go to a Web site or page. I wanted to use this for wickenburg-az.com, a site I spend an awful lot of time working on with no compensation. The idea was to charge a nominal fee to add an image to the pool for a month. The money I collected would cover the cost of running the site. Keep in mind that I could use any size image and place it anywhere in the header, sidebar, or footer. I wanted a 170 x 120 pixel image at the top of the sidebar. (I already run a strip of Google text ads at the bottom of the page, as I do here. I think too much advertising on a Web site is extremely obnoxious. But how much is too much when you have bills to pay?)The Plugin
I won't go into detail about my search for the plugin. It was neither long nor exciting. I wound up with AdRotator by Angsuman Chakraborty, which was really designed to work with Google AdSense and other prepacked blog advertising tools. But as I read the comments for the plugin's description, I was assured that it would do what I needed to do. But how do I use it? The User Manual was difficult to find. It wasn't very user-friendly, either. (No offense to the plugin author. Frankly, I think that every programmer should team up with a tech writer to get documentation written. Programmers program. Writers write. Programmers don't usually program and write -- although an exception does come to mind.) So I decided to write up a quick How To piece that would explain how to use AdRotator to do just what I wanted it to do. This isn't AdRotator documentation. It only explains how to use the plugin for one particular task. Also, these instructions don't explain every single step in minute detail. If you want that kind of explanation, buy a Visual QuickStart Guide. Instead, these instruction assume you have already mastered the basics of using your image editing software, an FTP client, a text editor, and WordPress.Create the Ads
First, use image editing software and your FTP program to create and upload the ad images.wp-contentfolder. I created a folder calledads(real creative, huh?) and put them there. For obvious reasons, the folder's permissions must be set so its contents are readable.Install and Activate the Plugin
To use any WordPress plugin, you must download it, install it, and activate it.AdRotator.phpfile to yourpluginsdirectory inside yourwp-contentdirectory.Create the Reference File
Now comes the part that seems to confuse most people (according to the comments). You need to create a plain text file that includes HTML for displaying the ad graphics with links to their URLs.Of course, you'll substitute real URLs and text for what is shown above. A real example from my setup would be:
.txtfile extension. In my example, I named itads.txt(not very creative).wp-contentfolder in your WordPress installation.Reference the Ads
Now you need to reference the AdRotator plugin in the theme file in which you want the ad to appear. Normally, this will beheader.phporfooter.php(for banner ads) orsidebar.php(for ad boxes or towers).Fatal error: Call to undefined function getad() in /home2/aneclect/public_html/mariasguides/wp-content/plugins/exec-php/includes/runtime.php(42) : eval()'d code on line 91