Ad Rotator for WordPress

Ad Rotator for WordPress

I have been working on WordPress for the last several months, I have been very impressed with everything this platform can accomplish. I love the fact that I can have our business people work on the web site and produce and publish content. The ability to write plugins I like a lot also.

I had to write an ad rotator that could display in a side bar on the website, the side bar in question was not able to accept widgets. So, I opened the functions.php file in my theme directory and added the function below.

This function will read all files in a specific directory, in this case the rotator directory right off the root of the web site. Only put image files in this directory, I did not add anything to handle other types of files.

The image file will be displayed and also wrapped in an anchor tag, the url will be built based on a static base url with the filename of the image added. For example, an image file named welcome-to-wordpress.jpg would have a anchor with the url of

I am using the random function built into PHP to determine what image to show, this is accomplished by loading all files from a directory into and array and calling the random function supply a min and max value. The min value is skip ‘.’ and ‘..’and the max is the highest indexer in the array.

To use this function I add a call to ImageLinkRotator() to the theme page in the location desired.


Introducing the new

Well, as part of my cleanup and organization project with my domain names I decided to keep as my “resume” and technology blog. I will blog about things that I work with as well as new technologies.

Having been in the computer industry professionally for over 15 years now, I have been involved in projects covering various aspects of technology throughout several industries. I have benefited from this depth by gaining a strong knowledge of solution design and business practices from some of the best people in the industry and expanding my knowledge set to handling many different situations.

I am a development manager, I manage other developers and also make recommendations on technology to the company I am employed with. I program in VB, VB.NET, C#, Java, PHP, TSQL and JavaScript. I work daily with MS SQL Server and develop ways of integration of systems in our core products. I do a lot of architecture work, designing architectures that are scalable, efficient and re-usable.

I do a lot of work with Web Services and communications between disparate systems. I have developed solutions that integration AS/400 to MS SQL Server as well as live integrated solutions that must stay in sync 24×7.