≡ 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 type=”text/javascript”

<?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.

Was this article helpful?