This video tutorial section I am going to explain about how to place rotating banner ads in thesis theme. What is rotating banner ads? Normally rotating banner ad means ad location has been changed for every impression. For example I am having six ad spots in my sidebar. I want to place six different 125×125 banner ads in my sidebar and also I need to rotate these ads for every impression ie, for every reload of the single page the banner ad moved to another ad spot in the available six ad spots. This tutorial tells about how to place these rotating ads.
Here I am going to tell you how to place inside multimedia box and sidebar. Just copy and paste the following code in custom_function.php or launch.php. any one of the above mentioned file you can paste the code.
/*rotating banner ads*/
function banner_ad_rotator() {
echo ' <div><center>';
/*Rotating Ad number 1*/
$ads = array(array("title"=>"AWeber - Email Marketing Made Easy",
"url"=>"http://aweber.com/?332932",
"img"=>"http://www.aweber.com/banners/email_marketing_easy/125x125.gif",),
/*Rotating Ad number 2*/
array("title"=>"Click here to watch The Conversion Blogging Video",
"img" =>"http://www.blogmastermind.com/images/banners/yaro125x125.gif",
"url" =>"http://www.entrepreneurs-journey.com/go.php?offer=cashclick2&pid=1&u=http://www.blogmastermind.com/video",),
/*Rotating Ad number 3*/
array("title"=>"OIOpublisher",
"img" =>"http://www.oiopublisher.com/images/banners/125x125_1.gif",
"url" =>"http://www.oiopublisher.com/ref.php?u=3606",),
/*Rotating Ad number 4*/
array("title"=>"ad4",
"img" =>"http://adwordsshop.com/wp-content/themes/thesis_16/custom/images/ad4.gif",
"url" =>"http://fourblogger.com",),
);
shuffle($ads);
$ads = array($ads[0],$ads[1],$ads[2],$ads[3]);
foreach($ads as $ad){
?>
<a href="<?=$ad["url"]?>"><img src="<?=$ad["img"]?>" alt="<?=$ad["title"]?>" border="0" width="125" height="125"/></a>
<?
}
echo ' </div></center>';
}
add_action('thesis_hook_multimedia_box', 'banner_ad_rotator');
To paste the code in custom_functio.php. login your wordpress admin.
- Choose ‘custom file editor’ under thesis options in left sidebar of the wordpress dashboard.
- Select custom_function.php file and click on edit selected file.
- Paste the above code and save it the visit your site.
To place the code in launch.php login your ftp.
- Select the path public_html/fourblogger.com/wp_content/theme/thesis_16/custom/lib/functions/launch.php.
- Open the file by right clicking on the file.
- Paste the above code and save it the visit your site.
You should use any one way only. Ad will appear as follows.
In the second impression or after the reload of the page Ad appear as follows.
The above code I am using only four ad spots inside multimedia box. This code you should replace your banner ad “url”, “img” ,and title. If you want to place one more ad.
Copy and paste the below after ad number 4.
array("title"=>"ad5",
"img" =>"http://adwordsshop.com/wp-content/themes/thesis_16/custom/images/ad4.gif",
"url" =>"http://fourblogger.com",),
You should change your own title, url and image in the above code and also add $ads[4].
$ads = array($ads[0],$ads[1],$ads[2],$ads[3],$ads[4]);
How to Place Rotating Ad in Sidebar
Thesis theme offers number of hook functions to place your ads in every location of your theme like above header, sidebars, inside multimedia box, below multimedia box and other locations. Only thing is you need to select corresponding hook for the placement of ad. You can place any location in the theme.
To place the ad in sidebar by changing the hook function, example.
add_action('thesis_hook_before_sidebars’, 'banner_ad_rotator');
If you want you style your ad spots by using custom.css file
This is for optional. You can change adblock size using the following code.
.custom .adblock {
Width: 270px;
text-align:center;
Height: 260px;
}
Share your experience in comment section.
For more checkout our all Thesis theme tutorials..
Related Tutorials:
- How to Add Banner Ads in Header of Thesis Theme
- How to Place Ads Box Before The Post Title in WordPress Thesis Theme?
- Thesis Theme Customization Tutorials for Sidebar Round-Up
- How to Place Your Ads Inside the Post of Thesis Theme?
- How to Add Social Bookmarking Icons in widgetized Header of Thesis Theme






{ 9 comments… read them below or add one }
Very cool. Changing the ads up can help mitigate some ad blindness. Now if there’s a way to track performance based on these ad blocks, that would be incredible.
Yes. Gabe. Can we do that track analysis by ourself? Is there any tools, can you recommend?
Hi,
This is not working because when I replaced the code of layout.php the blog was saying parsing error in layout.php can you guide where exactly to put the code and after which line? I couldn’t get it as I am newbie for thesis.. Thanks.
Give me Your site link then only we rectify your problem.
this code did not work
didn’t seem to work for me either
Very easy to understand tips but some links we need to change! No problem we will do that! Thanks Pascal
What if you wanted to display multiple (4 – 6) ads, but rotate them individually as opposed to displaying all at once? Can these be linked to open a blank browser window? Can this be done in a “second” multimedia box like in your other tutorial as opposed to the Thesis default multimedia box? Thanks.
plz help me
in Teasers = Teaser Display Options =
Warning: Invalid argument supplied for foreach() in /home/u841794885/public_html/wp-content/themes/thesis_182/lib/classes/options_design.php on line 1258
plz send me the corret file plz resolve my this problem