XF 1.5 Ad below 1st and 10th post?

rickhz

Well-known member
I have a conditional already set for showing an ad after the 1st post, but I have not been able to successfully place an ad after the 10th post.

Could someone please point me in the right direction?

TIA
 
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:
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10">
This content will show after post (10) on every page
</xen:if>
but it did not work out properly.
 
  • Be as clear as possible about what it is you are trying to do - Did my best
  • Include screenshots if possible, highlighting or describing the relevant section - Not relevant
  • In most cases it will be necessary to provide a link to your site so the code can be inspected - In my signature


It's been two weeks.
What more can I do to get an answer?
 
@Brogan

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:
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10">
This content will show after post (10) on every page
</xen:if>
but it did not work out properly.

I've tried what I have above, and it only showed the ad under the 1st post. What am I missing?
 
This is what I have now in my ad_message_below template. It works fine for showing an ad after the 1st post. How exactly do I add additional code to show ads below the 10th post. Pulling what little hair I have out right now as I have tried several different ways to install the code, and nothing has worked. All I windup doing is screwing up the formatting of the page.

I am trying to be as clear as I can with my questions. If you want more info from me ask. If you are sick of working on V1.5x tell me.



Code:
<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>
 
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:
Code:
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 10">
This content will show after post (10) on every page
</xen:if>
but it did not work out properly.
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..
 
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..


I tried combining them into one statement when I first started messing with this. It didn't work for me. No syntax errors, it just didn't display the 2nd ad. Since that didn't work I tried setting it up with two separate statements and of course that didn't work either.
 
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>
 
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>
Hi,
This code will work only with ad script like this:
Code:
<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>
But, with this kind of ad script:
Code:
<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>
Advertisements will display below every posts in the thread, i.e: thread has 11 posts --> advertisements will display below 11 posts --> causes overloading and members can not reply or reply with lots of time --> terrible issue

Thanks & Best regards
 
Back
Top Bottom