Rotating Ads

Jul 29th, 2009

in Multimedia Box, Plugins, Posts, Pages and Comments, Sidebars

If you’re interested in ways to monetize your blog this video is for you.
Using the OpenHook plugin, you can put rotating ads pretty much anywhere in your
Thesis site.

HTML framework used in the video is Page, not Full-width. (what’s this?)

The video goes through 2 examples:

  • Example 1: Inserting a block of three 125×125 ads.
  • Example 2: Inserting a block of two 200×125 ads

How do the two examples differ?

They don’t. I followed the same steps to insert both ad blocks. I went through
the same process twice just to make it clear.

Example 1

<!--Rotating Orange 125x125 ads-->
<div class="r_adblock125">
<?php
/*Rotating Ad 1*/
 $ads = array(array("title"=>"this is ad 1",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad1.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 2*/
 array("title"=>"this is ad 2",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad2.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 3*/
 array("title"=>"this is ad 3",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad3.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 4*/
 array("title"=>"this is ad 4",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad4.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 5*/
 array("title"=>"this is ad 5",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad5.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 6*/
 array("title"=>"this is ad 6",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad6.gif",
 "url"  =>"http://test2.thesis101.com",)
				 );
 shuffle($ads);
 $ads = array($ads[0],$ads[1],$ads[2]);

 foreach($ads as $ad){
   ?>
     <a href="<?=$ad["url"]?>"><img src="<?=$ad["img"]?>" alt="<?=$ad["title"]?>" border="0"/></a>
   <?
 }?>
</div>

CSS:

/* -------------- :[  ROTATING ADS 125x125 ]: --------------*/

.custom div.r_adblock125 img {
	padding: 1px;
	border:2px solid #797979;
	margin-bottom: 10px;
	margin-left: 10px;
	margin-right: 10px;
}
.custom div.r_adblock125 a:hover img {
	padding: 1px;
	border:2px solid #AB4119;
}
/*.custom .cenx {
	text-align: center;
}*/

Example 2

<!--Rotating 200x125 ads-->
<div class="r_adblock200">
<?php

/*Rotating Ad 1*/
 $ads = array(array("title"=>"this is ad 1",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad-green1.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 2*/
 array("title"=>"this is ad 2",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad-green2.gif",
 "url"  =>"http://test2.thesis101.com",),

/*Rotating Ad 3*/
 array("title"=>"this is ad 3",
 "img"  =>"http://test2.thesis101.com/wp-content/themes/thesis_151/custom/images/ad-green3.gif",
 "url"  =>"http://test2.thesis101.com",),

				 );
 shuffle($ads);
 $ads = array($ads[0],$ads[1]);

 foreach($ads as $ad){
   ?>
     <a href="<?=$ad["url"]?>"><img src="<?=$ad["img"]?>" alt="<?=$ad["title"]?>" border="0"/></a>
   <?
 }?>
</div>

CSS:

/* -------------- :[ ROTATING ADS 200x125  ]: --------------*/
.custom .r_adblock200 img {
	margin-bottom: 10px;
}
.custom div.r_adblock200 img {
	padding: 1px;
	border:2px solid #797979;
}
.custom div.r_adblock200 a:hover img {
	padding: 1px;
	border:2px solid #AB4119;
}
.custom .cenx {
	text-align: center;
}

View Demo

Pretty cool, huh? If you found this tutorial useful, consider swinging by Chris’s blog to say thanks—he is the one that put it together. ;)

Check out his demo page.
1 Star2 Stars3 Stars4 Stars5 Stars (3) Loading ... Loading ...

Share and Enjoy:
  • email
  • del.icio.us
  • Facebook
  • Digg
  • FriendFeed
  • Twitter
  • StumbleUpon
  • Technorati
  • Reddit
  • Yahoo! Buzz
  • @Bigspade- you're welcome! :)

    @niche09- a video on using podcast's or other audio with thesis sounds good but can you be more specific?
  • niche09
    Thank You Thank You Thank You ...Fabi
    very good video... you make it so simple so glad I found them keep up the good work.
    maybe a video on using podcast's or other audio with thesis???
  • Thanks for the video, love it.
  • Nice job putting this video together and thanks for link back to my original tutorial. Keep up the great work!
  • Hey Chris, around the time I did this video I came across a wiki you started. A wiki is such a great idea to put together some kind of Thesis documentation. Do you have any plans for it?
  • Fabi - Yes the wiki was started back before there were all these great Thesis reference sites, like yours, and did have a few tutorials at one time. It was my first experiment with the MediaWiki platform and apparently I should have installed some type of spam prevention because it looks to be overrun now. I do like the idea's of a wiki but I pitched the idea to Pearson and he didn't seem real interested so I kind of let it go. Maybe I'll have to revisit it sometime.
  • You know, I've installed MediaWiki twice before and it got spammed within an
    hour. So annoying.
    I'm very surprised that Pearson didn't jump all over the idea. I'll tell you
    what, if you ever decide to give the wiki another shot and need help, let me
    know. I'd love to see a Thesis wiki but I certainly don't want to do it by
    myself.
blog comments powered by Disqus

Previous post:

Next post: