Many of my friends found thesis theme the most challenging framework for wordpress. It is both ugly in terms of design and difficult to work with. It took them a lot of time to change a small thing like background colour, title font….I have also had the same feeling. However, Thesis theme is now my favorite framework and I have no plan to switch to other themes.
I have ever thought to quit using thesis theme after a while but I did not. The reason was simple as this framework has benefited me a lot in terms of both knowledge and money too.
It urges me to learn thesis theme hooks & filters and I am confident that I can play around with hooks now but not yet mastering all of them. Anyway, I feel very happy as I can do it myself rather than searching on the internet. However, CSS and special customization like what you see on this blog is out of my capability
Here are some tweaks that help you place any kind of ads on several positions of your thesis powered blogs. All things will go through custom_functions.php file and you do not need to edit your PHP file anymore. This is also a great feature that normal themes can not do.
1. Ad After & Before First Post Only on Home Page
This code will guide you how to place your ads on the homepage right under the first post. The ad will not show on the second post downwards as well as single posts.
Place this tag on your custom_functions.php file either through FTP or File Custom Editor tab n your WordPress admin:
Before the first article only:
function before_first_post_ad($post_count) {
if (is_home()) {
if ($post_count == 1) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
}
add_action('thesis_hook_before_post', 'before_first_post_ad');
After the first article only:
function after_first_post_ad($post_count) {
if (is_home()) {
if ($post_count == 1) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
}
add_action('thesis_hook_after_post', 'after_first_post_ad');
2. Ad After & Before Single Post Only:
This code wil help you show your advertisement only on single posts. You will never see your ads on homepage or pages. Place the tag below to your custom_functions.php file:
Before the single post only:
function before_single_post_ads() {
if (is_single()) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
add_action('thesis_hook_before_post', 'before_single_post_ads');
After the the single post only:
function after_single_post_ads() {
if (is_single()) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
add_action('thesis_hook_after_post', 'after_single_post_ads');
3. Ad After & Before Content
This function will enable your ads right after the content box of your thesis. You can position it either before or after contents:
Before the content only:
function before_content_ad() { ?>
// INSERT YOUR AD CODE HERE
<?php }
add_action('thesis_hook_before_content', 'before_content_ad', 1);
After the content only:
function after_content_ad() { ?>
// INSERT YOUR AD CODE HERE
<?php }
add_action('thesis_hook_after_content', 'after_content_ad', 1);
4. Ad on Pages Only:
If you want to have a specific ads on pages only, this tag will help you do that. Just place the code below in your custom_functions.php:
Before the pages only:
function before_page_ads() {
if (is_page()) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
add_action('thesis_hook_before_post', 'before_page_ads');
After the pages only:
function after_page_ads() {
if (is_page()) { ?>
// INSERT YOUR AD CODE HERE
<?php }
}
add_action('thesis_hook_after_post', 'after_page_ads');
5. Ad within single post:
Most of bloggers who are using Thesis theme love this tricks as it seems to increase their adsense CTR effectively. The code will show your ads next to your content and draw more attention from your readers that can lead to natural clicks too.
Just place the tag below in your custom_functions.php file and see how it can help you make more money:
function ad_within_single_post () {
if (is_single()) { ?>
<div style="float:right; padding-left:3px;">// INSERT YOUR AD CODE HERE</div>
<?php
}
}
add_action('thesis_hook_before_post','ad_within_single_post');
You can navigate your ads from right to left margin by changing “Right” to “Left” in the code. It is really easy right?
I hope these tutorials will help you insert your ads on the most popular postions on your thesis theme blogs without using any plugins.





{ 29 comments… read them below or add one }
Tinh that’s a useful post and this post was shared on Twitter and delicious now
Hi @Harsh, thanks for your comment and vote. I hope these tutorials will help some guys who are fans of Thesis theme
Tinh,
Great Post. Very Useful code for thesis Users.
Thanks for sharing.
Keep up the good work.
Thanks for your comment. I hope it helps some thesis fans
Good tutorial to help us improve more knowledge about Thesis, Tinh.
Thanks, hope you like it too
It’s nice to see others promoting Thesis theme and the ease of adding adverts. You also mentioned many areas where one could post adverts and I’m sure many users appreciate it.
I have thought about these positions that many bloggers are using now and I hope it can help some thesis fans too. Thanks George
Thanks for the awesome tutorial, appreciate it.
Thanks @Ben Lang for your first comment. I hope it help you sometimes
Thanks for this post, even though I know how to add these stuff to thesis already. But it will be helpful for the new thesis users. I will retweet this post
Thanks @Kharim for your retweets. I do appreciate that and hope it help other newbies who have just got used to Thesis
Hi.. nice entry.. I’m looking for this tutorial to add my Fb and Twitter button..
Thanks @Hidup. You can use this for adding social bookmarking buttons too
Yes.. i know.. anyway, your blog very nice design.. i like..
Thanks as you liked it. Your blog is good but it is in other language, not English so I can not understand
Hi.. your welcome..
yes, this blog is for my language..
maybe you can use google translation if you want reading it..
Thanks..
This is really helpful for the thesis theme users. Recently I converted thesis worpress theme into blogger template. Thats was not easy
There are several bloggers who have successfully converted Thesis theme into blogger template but the most important thing that many bloggers are concerned is its SEO capability. Your converted version at least looks awesome in terms of interface. Congrats friend!
Just visit your blog.Very nice
Hi
Thanks for this tutorial
Thats why i like to use thesis in my blog
Your blog is simply amazing. Ive been looking for how to insert ads in above the post area in thesis everywhere!!!thanks..
I also wanted to know if there is a way to put an ad somewhere in the MIDDLE of my post area, since my blog consists of a lot of pictures and I can only align my pictures centrally to make it most attractive. So, i was thinking of maybe having one or two pictures, then an ad under it, if you see what I mean.
thanks for your help:)
Ile Maurice recently posted..Q&R: Maurice : flic en flac ou trou aux biches?
Your case seems complicated that I can not help for now. I will try to find this tip and let you know later
Tinh Tran recently posted..Blogging Tips: To Moderate Comments or Not To Moderate Comments
thanks again. Will keep coming back
Thanks so much for this. I’m not even using ads, just custom HTML & PHP. But this is the only place I’ve found that articulates how to use the $post_count attribute to target specific posts’ hooks. A total lifesaver (or at least hairsaver, as I was pulling it out when the documentation said the attribute could be used but didn’t say *how*). Bookmarked!
It’s really great stuff, I haven’t tried this but it seems easy to implement. I want to put ads on my thesis and blogs, hope this will help me. Thanks.
thanks dude, very nice tutor
anyway i have a question, how to put ads in centre of content??
caenz recently posted..Senarai Peserta & Biodata Protege Mentor 6
What is that language? I think I need to wait for your English blog as I am a bit lazy reading translation and that tool sometimes can not translate properly
This is malay language.. Oh.. its ok.. but i agree with you that translation tool sometimes can not translate properly..