How To Add Google Adsense After/Before The Post Title in Thesis Theme?

Post image for How To Add Google Adsense After/Before The Post Title in Thesis Theme?

August 8, 2011

in How To, Thesis Theme

Thesis is the most robust and air tight SEO WordPress theme which offers a wide range of functionalities by using the core of the WordPress abilities and helps you in reducing the number of plugins used for your blog.

Check: Top 10 Free Thesis Theme Skins.

Google Adsense is an Ad platform which provides text, image and video advertisements and can generate revenues on either Per Cost per click (CPC) or Cost per impression (CPM) and allows webmasters to monetize their websites.

how to adsense ads after post title in thesis theme1 How To Add Google Adsense After/Before The Post Title in Thesis Theme?

Most of the blogs/websites rely on Google Adsense as it is the top ad service of its kind. As per a research, the space below post title is the most ad click prone area and is also proved as the best hot spot to display ads to get maximum clicks. Here is a tutorial which shows you how to add Google Ads (or any other ads which you would like to show) after or before the post title without using any plugin in Thesis WordPress Theme and achieve the same effect by editing the code.

How To Display Google Adsense Ads After Post Title?

  • First you need to create an Adsense slot of size (336×280) and copy the code.

Note: It is recommended to backup your theme before editing or changing the theme functions. (It is a safe practice to do things;)).

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

Now save the custom_functions.php and check your Website and see the changes (if you have created the adsense code just now, it will take upto 10 minutes for Adsense bot to show up the ads).

How To Add Google Adsense Ads Before Post Title?

  • The first 2 steps which are mentioned above remains same.
  • Copy and paste the code in custom_functions.php (make sure you use your own Adsense code here).
function adsense_ads() {
if (is_single()) { ?>
<script type=”text/javascript”><!–google_ad_client = “ca-pub-XXXXXXXXXXXXXXX”;
google_ad_slot = “XXXXXXXXXXXXXXX”;
google_ad_width = 336;
google_ad_height = 280;
//–></script>
<script type=”text/javascript”src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
<?php }
}
add_action(‘thesis_hook_before_post’, ‘adsense_ads’);

Now save the custom_functions.php and check your Website and see the changes (if you have created the adsense code just now, it will take upto 10 minutes for Adsense bot to show up the ads).

Hot Deals

Leave a Comment

Previous post:

Next post: