Insert Adsense Code Inside Single Post In WordPress Thesis Theme
Adsense allow you to show targeted advertisements to your blog readers. You can display adsense ads any where in your blog, but the most profitable and viewable place in a blog is post. Previously i wrote about inserting adsense inside post in wordpress blogs. In this tutorial i will show you that how can you insert adsense ads inside post in your thesis theme using Open Hook Plugin.
Thesis Open Hook Plugin allow you to place advertisement or any other CSS, PHP or HTML code any where in your blog. In this tutorial we are going to use Open Hook plugin to insert adsense ads inside single post. First of all download Open Hook Plugin.
Activate the plugin and then go to Dashboard>Apperance>Thesis OpenHook>
Find thesis_hook_after_post
Now paste your adsense code in this hook. In order to show the ads only in single post, make sure to paste adsense ad code in the middle of following code.
<?php if (is_single()) { ?>
<script type=”text/javascript”><!–
google_ad_client = “pub-xxxxxxxxxxxxxxxx”;
/* Title of the Ad */
google_ad_slot = “xxxxxxxx”;
google_ad_width = 300;
google_ad_height = 250;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php } ?>
Make sure to give a tick to the button which says “Execute PHP on this Hook” otherwise the code will not work.
Click on “Little Save Button” and visit your blog. You will see the ad inside your post. You can insert the code in any other hook, just paste the code there and the ad will appear.
If you have problem then feel free to ask in comment.
10 comments
Helene D'souza
Thanks! Worked great. =)
Microbiology Guy
Same problem here ad is appearing below the related posts how to avoid that.
Rafaqat
Thanks Bilal for this guideline,i think there is more easy way to insert adsense code in between post in single post is by using why do work plugin.By using this plugin you will find many options to show adsense codes or even any other html code also.Just try it I’m personally using it since by blogging.
Bilal Ahmad
Rafaqat@ Ok i will review the plugin.
venkat
Ad is appearing below related posts, how do I make it appear exactly below the post, what changes needs to do in code? then.
Mahesh
Thanks for the tip. This helped me to place the MGID widget code on my blog’s posts..
sudeep
hi,thanks for the information. I have question. Is there a way to insert an adsense ad on single post in between post text. What i mean is post title then some post text and then adsense ad and rest of the post ?
Well is this possible ?
Bilal Ahmad
Sudeep@ Yes can insert indsense in the middle of post. There a very useful plugin which help you in this. http://www.wppluginsblog.net/display-adsense-into-post-pages-and-sidebar-easily-using-trigger-text-adsense-wow-plugin/
rohan @techlunatic.com
@bilal -nice tip especially the one in which we define adsense ads as PHP, i suppose this is causing the error, if we run them as Javascript only they would run properly.
@Valente -Errors happen when working with thesis, its all trial and error so if you find a solution plz post it politely!
Valente Espinosa
It only appears this
script type=”text/javascript”>
but no Ad is shown.
Triple check the code and the execute as php button. bummer.