Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Hardcode Adsense code into post #1 and post #3
dzchimp Offline
Junior Member
**
Posts: 5
Joined: Nov 2011
Post: #1
Hardcode Adsense code into post #1 and post #3
I would like to know how to modify templates, to add manually Adsense <script> </script> codes specifically into the first and third post displayed on any page within a thread.

I have tried using the Conditionals plugin to see whether the post number is #1, and if so, it displays Adcode1, if it is post #3, then Adcode2.

There is a problem. I want ads to display on page 2, 3 etc too. If I got for the code which checks post number, then the ads display only on page 1!, I want them on subsequent pages too, serially on the first and third post on every page.

Here's the code I have tried so far.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<if $postcounter == '2' then>
<tr><div align="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-";
/* InthreadPost#2 */
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>
</div>
</tr>
</if>

<if $postcounter == '3' then>
<tr>
<div align="center">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-cy1";
/* Inpost#1 */
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>


This displays ads on Post #1 and Post #2 of page 1. I want ads on Page 2, 3 etc (all pages)

(This post was last modified: 11-20-2011 03:59 PM by dzchimp.)
11-20-2011 03:58 PM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Hardcode Adsense code into post #1 and post #3 - dzchimp - 11-20-2011 03:58 PM

 Standard Tools
Forum Jump: