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

<?php
$quotes = file(“http://yourdomain.com/banners.php”);
$quote = rand(0, sizeof($quotes)-1);
echo $quotes[$quote];
?>
<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=”https://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,
Gail

Share

Additional Articles From "Technical"

Comments

AffiliateMusketeer

Thanks, Gail, great post! I got a little confused around the ‘how to count the cloaked links’ section but I think that was more due to the time (3am) than anything else. I have tried your methods again this morning though and they work perfectly.

I’m using it on an unindexed landing page, driving traffic via PPC, and promoting a clickbank product. So far so good…


Gail

Glad you were able to get it going! Your problem with understanding probably had less to do with it being 3am when you were reading and more to do with it being 3am when I wrote it. ;)


charles

Hi Gail,

I tried your cloak link for clickbank, and it worked perfectly on the first time. the same cloak link can be used for commission junction as well?. I looked at your cloak link generator, not sure I understood it well, to give it a try.
thanks for your help Gail.

Warm regrds
Charles.


Gail

Hi Charles,

Glad you were able to use the clickbank code easily. I don’t use CJ much and haven’t tried to see if I could cloak the links. For the misc items I do promote, I use my own url shrinker. You can see it at https://wahguide.com/url , you are free to use that one if you like or you can install the script and use on your own site. You can download it at https://wahguide.com/freebies/url-shortner.zip , I also put a link to it in the freebies section. It’s easy to install and the readme file is included. If you have any problems with it, just let me know. On a side note, I think it would not be difficult to do Ebay links and I’ll look at that sometime soon.

Take care,
Gail


charles

Hi Gail,

Thank you so much for the reply. the url shrinker seems attractive. No Gail I did not use it yet, though just tested it. Just saw your reply, thought I will say thanks. will catch up with you once I try it out. Thanks again Gail.

Warm Regards
Charles.


sheldon

hi nice post pretty useful I got this to work, although it would be nice to know how to also include .html extension on the end instead of just http://yoursite.com/amz/B0011ZCDKS. I’m sure this can be all done in .htaccess file just not sure I’m a little bit of a green horn lol!


Gail

Hi Sheldon,

It’s no problem to add the .html to the end.

Replace
RewriteRule ^(.*)

with
RewriteRule ^(.*)\.html

Then your link would look like
http://yoursite.com/amz/B0011ZCDKS.html

This works with clickbank as well. And you can change the html to any file extension you want. It is basically just ignored anyway.


reza

hi,dear

thanks for useful tips you let me to know more about .htaccess.
how i can indexing my newly created sites using .htaccess in search engines like google?

thanks alot for article.


Justin

Whoa… this site is pretty awesome :) your layout is really well designed, and your blogs are (judging from what i’ve read) very interesting. heehee… consider yourself favorited. :-P


Anonymous

Hello, I enjoy reading through your blog, I wanted to leave a little comment to support you and wish you a good continuation. Wishing you the better of luck for all your blogging efforts.


Flippa Chick

Excellent post! I’ve switched over one of my dynamic websites to a static .html website and was looking for a more efficient way to cloak my Amazon links since I couldn’t use the features of plugins.

Thanks for sharing! :)


Hasith

Amazon Links idea great. I’m going to try it with my Amazon affiliate sites. thank you.


Share Your Thoughts
Name:
Email:
Website:
Comments: