18. How can I show content after post x on every page in a thread?
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == x">
This content will show after post x on every page
</xen:if>
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10">
This content will show after post (10) on every page
</xen:if>
I played around with this and didn't get the results I was after. What I am after is to show two ads under posts on each thread page.
My forum shows 25 posts at one time. Right now I just have an ad after the first post on each page using this code:
Code:<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
I tried adding this code:
but it did not work out properly.Code:<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10"> This content will show after post (10) on every page </xen:if>
<xen:hook name="ad_message_below" />
<xen:if is="!{xen:helper ismemberof, $visitor, 3, 4, 5, 45, 54, 55, 56, 62, 68}">
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
<li class="message">
<div class="messageUserInfo" itemscope="itemscope" itemtype="http://data-vocabulary.org/Person">
<div class="messageUserBlock">
<h3 class="userText">
<span style="font-weight: bold">Support EF</span>
<em class="userTitle" itemprop="title"></em>
</h3>
<span class="arrow"><span></span></span>
</div>
</div>
<div class="messageInfo primaryContent">
<div class="messageContent">
<article>
<blockquote class="messageText ugc baseHtml">
<!--INFOLINKS_OFF-->
<div align="left">
<center><b><a href="/xenforo/index.php?account/upgrades">Join the Elite Explorers for $20</a></center></b>
<br>Explorer Forum has probably saved you that much already, and will continue to save you money as you learn how to diagnose
fix problems yourself, and learn which modifications work without having to experiment on your own.
<b>Elite Explorer members see practically no ads, can add their own profile photo, upload photo attachments directly to your posts and Media Gallery,
create more private Conversations, and more</b>. <b><a href="/xenforo/index.php?account/upgrades"> Join Today.</a></b> Your support is greatly appreciated.
<br>
</div>
<center>
<!-- Below post -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- Below 1st post -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-xxxxxxxx"
data-ad-slot="2826698934"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</center>
<!--INFOLINKS_ON-->
<br /><br /><label for="LoginControl"><span style="font-weight: bold; color: #004400"><a href="/forums/index.php?account/upgrades" class="concealed noOutline">Log in or Sign up</a></span></label> to hide adverts.
</blockquote>
</article>
</div>
</div>
</li>
</xen:if>
</xen:if>
Those two by themselves look fine, it's not clear how you have tried to combine the two together.I played around with this and didn't get the results I was after. What I am after is to show two ads under posts on each thread page.
My forum shows 25 posts at one time. Right now I just have an ad after the first post on each page using this code:
Code:<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
I tried adding this code:
but it did not work out properly.Code:<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10"> This content will show after post (10) on every page </xen:if>
Those two by themselves look fine, it's not clear how you have tried to combine the two together.
On mobile at the moment but am certain you just need to combine the two into a single statement using AND and OR as per the guide..
<xen:hook name="ad_message_below" />
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
<div style="height: 50px; background-color: orange">Test</div>
</xen:if>
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 9 AND !{$message.conversation_id}">
<div style="height: 50px; background-color: orange">Test</div>
</xen:if>
Hi,It works fine for me: http://0d424afbd0e39f86.demo-xenforo.com/1510/index.php?threads/test.1/
Using this code in the ad_message_below template.
HTML:<xen:hook name="ad_message_below" /> <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}"> <div style="height: 50px; background-color: orange">Test</div> </xen:if> <xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 9 AND !{$message.conversation_id}"> <div style="height: 50px; background-color: orange">Test</div> </xen:if>
<div id="data_xxxx"></div><script data-cfasync="false" async type="text/javascript" src="//www.xxxx.io/display/items.php?xxxx&60809&728&90&4&0&0&0&0"></script>
<iframe src="https://xxxxx.pro/a.WeZcy-xxx/pLvAAAYmsV/JnZODi0-zNOXDkg/x/OoD/Q/1n" style="width:728px; height:90px; border:0px;" width="728" height="90" frameborder="0" scrolling="no"></iframe>
We use essential cookies to make this site work, and optional cookies to enhance your experience.