• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Ad after first post - which template?

Diablotic

Active member
#1
Which template should I use to insert my code that would display ad after first message (outside first message) in the way it looks like it is another post.
I have my code ready but I cannot figure into which template I should insert it to.
 

Diablotic

Active member
#4
@Brogan: That was the first conditional I used and it didn't work that's why I started this thread.
Using this conditional it displays advert in the first post but I do want it to show outside it, just as it is another, standalone post.

@principia: I do not want to use any addons to do that.
 

Brogan

XenForo moderator
Staff member
#5
It doesn't display it in the post, the ad_message_body template does that.

If you want to create more separation however, add this as the first line in the ad template

</li><li>
 

Diablotic

Active member
#6
Yes, had tried that before but also with no luck.

First picture is for the option without </li><li>
Second one is what happens after I use </li><li>

withoutli.jpg
withli.jpg

As you can see adding the code into ad_message_body is adding "advert" into first post. I do not want that. I want to have "advert" between first and second post.

Using XF 1.0, no changes to the default theme.
 

Brogan

XenForo moderator
Staff member
#9
That's just text explaining which hook is used.

You can remove that and place whatever code you want in that template.

As I said though, you need to use the ad_message_below template, not the ad_message_body template.
 
#11
Hey guys, what will I need to edit in the conditional if I want to display this Ad only to non-registered users?

<xen:if is="{$post.position} == 0">
advert
</xen:if>
 

Jens1986

Active member
#13
It doesn't display it in the post, the ad_message_body template does that.

If you want to create more separation however, add this as the first line in the ad template

</li><li>
Why does this code not work?

ad_message_below:
Code:
<xen:comment> PLACE YOUR ADVERTISEMENT CODE DIRECTLY BELOW </xen:comment>
</li><li><xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND {$thread.reply_count} > 0">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- ALOPECI TOPP -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-...."
     data-ad-slot="...."
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
It breaks the design, the posts after post #2 goes to 100% width
 
#16
Also having issues with <li class="">my adsense code</li> in ad_message_below (right after first post)

I've successfully added it at the end of all messages and above threads list but somehow adding it in ad_message_below it breaks the design leaving 2nd post showing as empty.
 
#18
I don't really see a reason to install an addon just for this.

Also adding a banner without any <li></li> has the exact same result that addon has, my issue starts while adding the <li> tags.
 
#19
ad_message_below

Use this conditional:

<xen:if is="{$post.position} == 0">
advert
</xen:if>
Bro it works with going under the first post, only problem is that it looks messed up for me. Any ideas on how this could be resolved or what the cause could be?

Thanks in advance.

Screen Shot 2016-02-03 at 8.09.57 PM.png

I added the code to the ad_message_body to avoid the above issue but now I need the ad to appear underneath the content of the 1st post.

This is what I have now:

Screen Shot 2016-02-03 at 8.16.03 PM.png

The reason why I need it under is because I have an ad in the ad_above_content template so it clutters the page as it is now.
 
Last edited: