Help - Search - Members - Calendar
Full Version: Google Adsense Ads
Movable Type Community Forum > Using Movable Type > Templates and Tags
norbiu
how can I add a banner ONLY after the first post ?

thanks
TwistedFate
Consulst the MT docs on using MTEntries with lastn="#" and offset="#"

What you will need is a complete MTEntries block with a lastn value of 1, then your AdSense code, then another complete MTentries block with a lastn value of however entires you want displayed and an offset of 1. This will give you this.

Most Recent Entry

AdSense Bar

Next Most Recent Entry

Third Most Recent Entry

Fourth Most Recent Entry

etc....
norbiu
it worked.

thanks a million ! wink.gif
jackburton
@TwistedFate,

I'd really like to do this as well (but with an affiliate banner after the first post instead of ADsense) can you break down the steps a little bit more to a noob? (I just installed MT last week and I'm completely new to this, so please be gentle. ) smile.gif
TwistedFate
I'll do better than that
CODE
<MTEntries lastn="1">
<$MTEntryTrackbackData$>

<MTDateHeader>
<h2><$MTEntryDate format="%x"$></h2>
</MTDateHeader>

<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3>

<$MTEntryBody$>

<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>

<p class="posted">Posted by <$MTEntryAuthor$> at <a href="<$MTEntryPermalink valid_html="1"$>"><$MTEntryDate format="%X"$></a>
<MTEntryIfAllowComments>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#comments">Comments (<$MTEntryCommentCount$>)</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</p>

</MTEntries>


. . .  Insert Affiliate Banner here . . .


<MTEntries lastn="9" offset="1">
<$MTEntryTrackbackData$>

<MTDateHeader>
<h2><$MTEntryDate format="%x"$></h2>
</MTDateHeader>

<h3 id="a<$MTEntryID pad="1"$>"><$MTEntryTitle$></h3>

<$MTEntryBody$>

<MTEntryIfExtended>
<p class="extended"><a href="<$MTEntryPermalink$>#more">Continue reading "<$MTEntryTitle$>"</a></p>
</MTEntryIfExtended>

<p class="posted">Posted by <$MTEntryAuthor$> at <a href="<$MTEntryPermalink valid_html="1"$>"><$MTEntryDate format="%X"$></a>
<MTEntryIfAllowComments>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#comments">Comments (<$MTEntryCommentCount$>)</a>
</MTEntryIfAllowComments>
<MTEntryIfAllowPings>
| <a href="<$MTEntryPermalink archive_type="Individual"$>#trackbacks">TrackBack (<$MTEntryTrackbackCount$>)</a>
</MTEntryIfAllowPings>
</p>

</MTEntries>


You can just cut & paste this into your Main Index template. Insert you Affiliate Banner code where specified and rebuild.

This will give you (after you insert your affilate code) 1 post then your Affiliate Banner, than the next 9 posts. If you want fewer posts in the second section just adjust the lastn="9" in the second block to however many entries you want. If you want the Affiliate Banner to come after a different post than the first one, then just adjust lastn="1" in the first block and the offset="1" to the number of posts you want before the affiliate banner.
jackburton
Fantastic! It works like a charm! Thanks so much TwistedFate!
ducaine
Thanks a lot this worked great! However google is not showing relevant links to the post any suggestions? It does however show relevent links when you click "continue reading."
elisebauer
Google ads will show relevant links to the content that is on a page, not to a specific entry if there happen to be more than one entry on a page. That's just the way it works.
ducaine
I must be doing something wrong because I tested it with one entry and I still get irrelevent links. And when I click "continue reading" it shows relevent links. In theory it should be the same because it is the same content. Any suggestions?
Carla Beth
When I was using Google ads, it took a good day or so for relevant links to start showing up.
yves.luther
@TwistedFate

Hi,

what could I do to prevent the second MTDateHeader to appear?
NicoGrrl
Remove the MTDateHeader tag from the second full MTEntries block. In other words, remove this:

CODE
<MTDateHeader>

... other code ...

</MTDateHeader>
elisebauer
There's a suggestion from Arvind in the comments below Google Adsense Placement After First Post for this using the MTEntriesHeader tag. I haven't had time to check it out, but it looks like it could do the trick. What you want is to not repeat the same date header after the first entry, correct? Not to abolish date headers altogether after the first entry.
yves.luther
@elisebauer

Exactly. This what I want.

Monday
1. Entry
-Banner Ad-
2. Entry
3. Entry
Tuesday
4. Entry
5. Entry
etc.

BTW It would be nice to be more flexible concerning the position of the banner ad. If your entries are very short, a placement behind the third entry might be better. Do you have another idea?

PS If there is no possibility for the above decribed way of positioning the banner ad wherever I want. Could you explain how the nesting/wrapping MTEntriesHeader, MTDateHeader, and MTEntryDate should work?
elisebauer
QUOTE
Could you explain how the nesting/wrapping MTEntriesHeader, MTDateHeader, and MTEntryDate should work?


Haven't tried it myself. But if you figure it out, please come back and post here and let us all know.
GnomeGrrl
I use Lynda's (So Very Posh) version. PHP is required, and she uses EE, but all you need to do is sub the EE stuff for MT stuff, so it would look like:

CODE
<?php $googlead = "0"; ?>
<MTEntries lastn="7">
<?php if ($googlead == 1) { ?>
<$MTInclude module="adsense"$>
<?php } ?>
REGULAR ENTRY CODE
<?php $googlead++; ?>
</MTEntries>
stargaze
I HAVE A BIG BIG BIGGG problem!!

I have three ads. in other pages they show but in my category view they won;t// only one shows up.. if i remove that one, the next ad shows.. what the heck's wrong with my mt??
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.