1. 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

Discussion in 'XenForo Questions and Support' started by gavpeds, Aug 23, 2016.

  1. gavpeds

    gavpeds Active Member

    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.
  2. Brogan

    Brogan XenForo Moderator Staff Member

  3. gavpeds

    gavpeds Active Member

    Perfect i looked through all of them but couldn't find this one, must be blind!
  4. gavpeds

    gavpeds Active Member

    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.

    <xen:if is="!in_array({$forum.node_id}, array(54, 138, 164, 49, 160, 148))">
    <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"
    (adsbygoogle = window.adsbygoogle || []).push({});
  5. Brogan

    Brogan XenForo Moderator Staff Member

    That should work but you will also need to move the 'Advertisement' and '<br>' lines to below the second xen:if.
  6. gavpeds

    gavpeds Active Member

    Ah that's why. Stupid me! Thanks brogan
  7. AndyB

    AndyB Well-Known Member

Share This Page