Thesis theme is become one of the most, if not the most used WordPress theme in the blogosphere, especially in many top blogger such as Google’s Matt Cutts, search engine industry legend Danny Sullivan, web-hosting entrepreneur Scott Beale, SEO guru Michael Gray and of course me with my cabinrentalsideas.com site.
The reason is simple. Thesis is very flexible. You really have a great deal of control. The big part is that it integrated SEO features and simple and unique framework. Compared other WordPress themes out there, Thesis has the ability to be very easy to customize without needed to having PHP or html knowledges.
If you want to add feature box,multimedia box all you need to do is to add hooks. Recently, I have tested several Adsense plugins on my blog cabinrentalsideas.com to show Google adsense ads. But i can say that I was unsatisfied by using all those adsense plugins.
So, recently I started experimenting different thesis hook in order to display Adsense ads both after post and after the title in my Thesis Theme. Below, I’ve put the exact step by step process that explain how I done it.
How To Add Adsense To Thesis After Post And After The Title
First and foremost you need to go into the Thesis custom folder through an FTP Client Software. Now open custom_functions.php with a text editor, then add the following code inside it in order to add an ad right after the title:
function before_post_ads() {
if (is_single()) { ?>
Your Ad Code Here !
<?php }
}add_action(‘thesis_hook_before_post’, ‘before_post_ads’);
Now where you read: “Your Ad Code Here!”, put you adsense code. Once you have adds your Google adsense code, save it. That it! The result you get should be similar to this:
function before_post_ads() {
if (is_single()) { ?>
<script type=”text/javascript”><!–
google_ad_client = “pub-XXXXXXXXXXXXXX”;
/* 250×250, created 8/17/09 */
google_ad_slot = “XXXXXXXX”;
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php }
}add_action(‘thesis_hook_before_post’, ‘before_post_ads’);
Now, If you want to add an ad right after the post, here the code:
function after_post_ads() {
if (is_single()) { ?>
<?php }
}add_action(‘thesis_hook_after_post’, ‘after_post_ads’);
Here, the result with your Google adsense code added:
function after_post_ads() {
if (is_single()) { ?>
<script type=”text/javascript”><!–
google_ad_client = “pub-XXXXXXXXXXXXXX”;
/* 250×250, created 8/17/09 */
google_ad_slot = “XXXXXXXX”;
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php }
}add_action(‘thesis_hook_after_post’, ‘after_post_ads’);
To align the Ad inside Thesis Post, for instance, if you want that your ad appears on right side of first paragraph, then add this piece of code:
function before_post_ads() {
if (is_single()) { ?>
<p style=”float: right;margin: 4px;”>
<script type=”text/javascript”><!–
google_ad_client = “pub-2176591172991554″;
/* 250×250, created 8/17/09 */
google_ad_slot = “2077149963″;
google_ad_width = 250;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script></p>
<?php }
}add_action(‘thesis_hook_before_post’, ‘before_post_ads’);
I hope you found this article useful in order to help you to adding adsense to Thesis theme.










Very nice walkthrough!
Managed to put up an ad between the title / meta and content on my site.
Thanks!
Like or Dislike:
1
0
[Reply]
Hey Nick,
I like your explanations and I tried to use them to put an adsense block right after the title of one of my pages, but it didn’t work. I think it has to do with conditions. Do you think you can drop me the correct line, instead of is_single() ?
Thanks for the tutorial, even though I couldn’t get it right, it’s still an eye opener for absolute newbies like me.
Like or Dislike:
0
0
[Reply]
Thank you so much, but i have one more doubt , how to add adsense to the left of post
Like or Dislike:
0
0
[Reply]
Nicola Deiana Reply:
May 11th, 2010 at 3:59 pm
@pondicherry times, Hi Pondicherry, look here
http://franklinbishop.net/thesis-tutorial-ads-in-sidebar/
This tutorial is for add banner ads(125×125) to the left of post, but it is right for adsense as well.
I will write a full post on how to add adsense to a blog header, home page, and left of post soon!
Like or Dislike:
0
0
[Reply]
This is very helpful indeed. Thanks for sharing this technique. I applied it on my site. Thanks again.
Like or Dislike:
0
0
[Reply]
Hey Nicola how do I remeove adsense from pages using openhook? COuld you provide me the code?
Like or Dislike:
0
0
[Reply]
thanks you
Like or Dislike:
0
0
[Reply]
Done, and thanks!
Is this ad placement working well for your site? If you’re willing to share, I’d love to know which ads are working best for you.
Like or Dislike:
0
0
[Reply]
done .it working.thanks for sharing
Like or Dislike:
0
0
[Reply]