site
stats
≡ Menu

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

adsense inside thesisNow 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… add one }
  • Valente Espinosa

    November 23, 2010, 9:44 pm

    It only appears this

    script type=”text/javascript”>

    but no Ad is shown.

    Triple check the code and the execute as php button. bummer.

    Reply
  • rohan @techlunatic.com

    January 19, 2011, 5:09 am

    @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!

    Reply
  • sudeep

    January 26, 2011, 4:33 am

    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 ?

    Reply
  • Mahesh

    February 19, 2011, 7:46 am

    Thanks for the tip. This helped me to place the MGID widget code on my blog’s posts..

    Reply
  • venkat

    March 1, 2011, 9:22 am

    Ad is appearing below related posts, how do I make it appear exactly below the post, what changes needs to do in code? then.

    Reply
  • Microbiology Guy

    September 10, 2011, 9:22 pm

    Same problem here ad is appearing below the related posts how to avoid that.

    Reply
    • Rafaqat

      December 24, 2012, 4:40 pm

      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.

      Reply
      • Bilal Ahmad

        December 24, 2012, 10:15 pm

        Rafaqat@ Ok i will review the plugin.

        Reply
  • Helene D'souza

    May 11, 2013, 3:37 pm

    Thanks! Worked great. =)

    Reply

Leave a Comment