If you would like to setup banner rotation on your wordpress blog like you see here at the top and bottom of this page (refresh to see different banners), just use the following code and instructions and you can have rotating banners on your blog in two easy steps.
The banners.php file which will hold the html for the banners and the code you will insert into your theme templates to call the banners.php file. You can actually use text and or banners. Just format the way you want and make sure the entire code is on one line and not wrapped (it may wrap here because of space constraints).
Open a blank text document and start adding your banner code. One per line.
<a href=”URL1″ target=”_blank”><img src=”image1_url” width=”468″ height=”60″ border=”0″></a>
<a href=”URL2″ target=”_blank”><img src=”image2_url” width=”468″ height=”60″ border=”0″></a>
Save this file as banners.php and upload to your server.
Login to your wordpress admin and navigate to the theme editor.
Paste the following code into your index.html file
$quotes = file(“http://yourdomain.com/banners.php”);
$quote = rand(0, sizeof($quotes)-1);
<br /><br />
Paste it in directly above
<?php if (have_posts()) : ?>
Be sure and change the “yourdomain.com” to your domain.
If you want banners to show at the bottom of your page as well, paste the code again directly after…
<?php endwhile; ?>
If you wanted different types of banners showing on the top and bottom, you could create a second banners file and name it banners2.php and then change the code to call that in your second. You could even call one text.php and use only text links instead of banners. Example below.
<div class=”item_class_text”><p><font size=”4″ face=”Verdana”><p>Internet Marketer Gets $87 Million in Google Pay-Per-Click Ads FREE!</font><br><br>And Makes Over $314 Million as a Result! And Now He’s Going to Give You This Same Secret for Next to Nothing! The fact is… ***You DON’T have to pay for another Google AdWords ad ever again!***<br><br><b><a href=”http://wahguide.com/url/d4Xy200sm”>Claim your copy of Get Google Ads FREE</a></b>!</p></div><hr>
Just create the text link in Frontpage or other html editor and then paste the entire code onto one line in your banners.php, banners2.php or text.php (the file name doesn’t matter as long as you are not overwriting an existing file and you change the code you paste into your template to call the correct file).
Now go paste the code into your other template files where you want the banners to show like your archives.php and single.php
If you want the banners to show on your search results page, edit the search.php and paste the code directly beneath <div id=”content”>
This works on the wordpress theme used on this site and the others I use. Depending on your theme, the place you paste the code may vary. It’s good practice to always copy the code in your template file and keep it in a text document until you are satisfied with the changes so you can quickly restore to previous version if something gets messed up.
In case I didn’t make any sense with this post which would not be completely out of character for me, just leave a comment below if you need me to try and be a little clearer about something.
Also, I didn’t go into it here but if you are familiar with setting up custom category pages (wordpress tutorial), you can create matching banner files and only show relevant advertising on your categories.
There are many affiliate programs which don’t offer banners for their affiliates, some have banners but they are very limited, not the correct size we want or they are over saturated. A quick and easy solution if you are not a graphics pro is to use Banner Generator Pro which is simple to use and will allow you to easily generate custom banners you can use. This is a great way to blend your banners with your websites while displaying a unique banner they’ve not been exposed to on the twenty sites they visited on their way to your site. WATCH THE BANNER GENERATOR PRO DEMO VIDEO
AND… one last thing. You aren’t limited to banners or advertising. You can also rotate random text, such as a quote of the day or other message.
Til next time,