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

XF 1.5 Exclude ad in some forums

gavpeds

Active member
#1
I am using the ad_thread_view_below_messages to display ads. What i want to do though is not show this ad in some forums. Can i use a conditional for this? I tried searching but could not find the one i needed.
 

gavpeds

Active member
#4
Right so I am trying to get an ad to show after first post in all threads. I have the below however it seems to be trying to show ads after every post.

I have this in ad_message_below.

Code:
<xen:if is="!in_array({$forum.node_id}, array(54, 138, 164, 49, 160, 148))">
Advertisement
<br>
<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 0 AND !{$message.conversation_id}">
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- myad -->
<ins class="adsbygoogle"
     style="display:block"
     data-ad-client="ca-pub-000000000"
     data-ad-slot="00000000"
     data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</xen:if>
</xen:if>
 

Brogan

XenForo moderator
Staff member
#5
That should work but you will also need to move the 'Advertisement' and '<br>' lines to below the second xen:if.