How to Add Google Adsense ads After/Before the Post Title in Thesis Theme

Hai friends..Adsense is one of the best way to earn money online .You can add adsense code to thesis theme easily by using thesis hooks.Here is a Short tutorial on How to Add Google Adsense After/Before the Post Title in Thesis WordPress Theme

Thesis 1.x : Follow this tutorial only if you are using thesis 1.x theme.

Thesis 2.x : If you are using the latest version of thesis , then you can use Quick Adsense Plugin to add ads to your theme.

How to Add adsense ads after Post Title:

 Google Adsense adsBefore the Post Title

#Create an Adsense ad of 300×250 size in Myads tab in adsense dashboard and click on get code

#Open your custom_functions.php of your thesis theme by using Filezilla or through the Custom File Editor under Thesis options

#Backup your file before you add the adsense code

#Now copy and paste the below code into the php file

/*Adsense ads after post title */
function adsense_ads_after() {
if (is_single()) {?>
<script type="text/javascript"><!--
google_ad_client = "pub-adsense";
/* MtsPost300x250 */
google_ad_slot = "adds";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<?php }
}
add_action(‘thesis_hook_after_post’, ‘adsense_ads_after’);

#Now replace the codes in red with your adsense ad unit code.

#Save the file and refresh your page.Your adsense ads will be shown

right after the post title

Note:The ads will take 10 to 20 minutes to appear in your blog.

How to Add adsense ads Before Post Title:

#Just change the thesis hook name as thesis_hook_before_post instead of 

thesis_hook_after_post

#Here is the code to ad Before post tit/*Adsense ads after post title */

function adsense_ads_before() {
if (is_single()) { ?>
<script type=”text/javascript”><!–google_ad_client = “ca-pub-…..”;
google_ad_slot = “………”;
google_ad_width = 336;
google_ad_height = 280;
//–></script>
<script type=”text/javascript”src=”https://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php }
}
add_action(‘thesis_hook_before_post’, ‘adsense_ads_before’);

#Simply copy and paste with your ad code to the custom_functions.php file as mentioned above.

#Save the file

This post is a part of Thesis Customization Tutorials .Hope you have successfully added adsense to your blog post after or before title.

If you have any errors in adding the code,notify us  in the comment section we will help you 🙂

9 comments… add one
  • Cool iPhone 4S Apps Feb 23, 2012 @ 10:45

    I wish you can also add tutorial on how to ad Adsense ad just below the post title with Elegant Themes.

  • Lyricsyou Mar 2, 2012 @ 9:57

    Thanks for yours Help but ia ma unable to place ads Theme going offline whenever i am trying..

    • Gowtham Mar 3, 2012 @ 18:39

      I looked at your site.You can give me your login details so that i could help you with the code.Contact us via facebook.

  • Tanji Mar 12, 2012 @ 10:06

    Dear sir, I am using thesis theme and show adsense code below post title. But it is safe if I could draw a line right after post title that could distinguish post title and ads. This is done to escape from google banned. Would you please advise me how could i place a line between post title and ads?

    • Gowtham Mar 12, 2012 @ 19:44

      Drawing a line after the Ads will not get you banned.You can implement the line after post title by using the custom.css file .Thanks.Do visit again

  • exinco Apr 22, 2012 @ 12:55

    How to insert after or at the end of article for wordpress theme blog

    Thanks.

    • Gowtham Apr 22, 2012 @ 13:54

      To add adsense after post to wordpress theme , you can use plugin such as Quick Adsense to add ads at different places of your blog.Thanks Exinco for your valuable comment.

  • aries Sep 1, 2013 @ 21:42

    Great article..
    Please tell me, how to add Adsense before title post in home, not in single post. I using thesis 1.8. thanks a lot..

    • Gowtham V Sep 1, 2013 @ 21:47

      To display the ad only in home. Replace the if (is_single()) function with
      if (is_home()) in the php function on line 2.
      Let me know if you need any help .

Leave a Reply

Your email address will not be published. Required fields are marked *