Social Networks

Thesis is a great theme that takes some getting used to. Even with the great tutorials available, it took me a little time to add Adsense to the Thesis Theme because I did not find an article on doing exactly that.

Adding a variety of Ads to your blog design is a smart and intelligent way to diversify your blog’s advertisement portfolio.

wordpress-logo

This post is for the people who’s don’t like to use any Plugin for showing Google Adsense Before-After Post in thesis theme.

Showing Adsense before post and after post is good idea to get maximum clicks.

Please take backup of Your Current Theme Functions (custom_functions.php)Before editing !

How To Add Google adsense Before-After Post Without Plugin

First of all copy your Google Adsense code which look like below:


<!--
google_ad_client = "pub-000000000000000";
/* 300x250, created 3/15/11 */
google_ad_slot = "0000000000";
google_ad_width = 300;
google_ad_height = 250;
//-->

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">

Open your Dashboard go to –>Thesis –>Thesis Custom File Editor–>custom/custom_functions.php

Before Post:

Copy Below Php code and paste inside custom_functions.php


function my_google_Ad() {
if (is_single()) { ?>
<!--
google_ad_client = "pub-000000000000000";
/* 300x250, created 3/15/11 */
google_ad_slot = "0000000000";
google_ad_width = 300;
google_ad_height = 250;
//-->

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<?php }
}
add_action('thesis_hook_before_post', 'my_google_Ad');

After Post:

Copy Below Php code and paste inside custom_functions.php


function after_post_ad() {
if (is_single()) { ?>
<!--
google_ad_client = "pub-000000000000000";
/* 300x250, created 3/15/11 */
google_ad_slot = "0000000000";
google_ad_width = 300;
google_ad_height = 250;
//-->

<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
<?php }
}
add_action('thesis_hook_after_post', 'after_post_ad');

Now click on save button and check your Website.If you done everthing right you ads will be be start showing on Before and After Post of your blog.

I will be happy to see your comments

Leave a Reply

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

Allowed Tags:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>