Ad Between Posts? (General)

by Stian @, Wednesday, August 03, 2011, 17:33 (4669 days ago)

Hi, is there any way I can place adsense code between posts?

The idea is to place an ad between the second and the third post in any thread.
If a thread has less than two posts, then no ad code.

Ad Between Posts?

by arye, Thursday, August 04, 2011, 21:24 (4668 days ago) @ Stian
edited by arye, Thursday, August 04, 2011, 21:51

open subtemplates/thread.inc.tpl.

Find:(in web_2.0 theme)

<div class="thread-posting{if $data.$element.new} new{/if}" id="p{$data.$element.id}">

Add above:

{if $data.$element.id==3}
{literal}
<script type="text/javascript"><!--
google_ad_client = "pub-****";
/* 728x90, FreeServ Adsense */
google_ad_slot = "*****";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
{/literal}
{/if}

Also did so in thread_linear.inc.tpl...:-D

Ad Between Posts?

by arye, Friday, August 05, 2011, 06:26 (4667 days ago) @ arye
edited by arye, Friday, August 05, 2011, 07:01

Oops it will work only in the first topic of the all Forum:lookaround:
-------------------------------------
So Try this code:yes:

open subtemplates/thread.inc.tpl.(in all themes)

Find:

<div class="thread-posting{if $data.$element.new} new{/if}" id="p{$data.$element.id}">

Add above:

 
{if $data.$element.pid==0 && $category_name}
{assign var=myid value=$data.$element.id}
{/if}
{if $data.$element.id==($myid+2)}
Your ad here:)
{/if}

Ad Between Posts?

by anuttama, Monday, August 08, 2011, 10:54 (4664 days ago) @ Stian

Get your Adsense code from the Adsense website
Parse the code to replace special characters with HTML entities
In Blogger, go to Layout, then choose Edit HTML
Make a backup of your template by clicking Download Full Template
Click Expand Widget Templates
Search for < data:post.body/ > or
< p > < data:post.body/ >< /p >
Place your Adsense code on the line immediately above this
Save the template

Regards,
Anuttama
Come and Join us

www.lookbeyondresumes.com

RSS Feed of thread