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

Hide content within specific thread

Discussion in 'XenForo Questions and Support' started by Michael, Dec 13, 2012.

  1. Michael

    Michael Active Member

    Hi everyone,

    I need to hide ads which I have in several templates from 1 thread due to the thread content violating Adsense TOS.

    I know theres this but thats to show within specific threads:

    <xen:if is="{$threadId} == x">
    This content will show in thread x
    </xen:if>

    How can I make that into do not show?

    Thank you :)
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    This works in the thread_view template:

    Code:
    <xen:if is="{$thread.thread_id} != 1">
    	THIS WILL NOT SHOW IN THREAD_ID 1
    </xen:if>
    
    The question becomes, where are your ads located? In which templates? If the templates are in the container scope then this code won't work and you will have to pass the thread_id via xen:container. Example:

    http://xenforo.com/community/threads/language-attribute.15249/#post-200171
     
  3. Michael

    Michael Active Member

    Theyre in ad_message_below, ad_message_body and logo_block, the code doesnt seem to work, do you know the exact code I will need?

    Thanks Jake :)
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The above code will work in ad_message_below and ad_message_body, but not in logo_block.

    For logo_block you need to use xen:container. Edit this template:

    Admin CP -> Appearance -> Templates -> thread_view

    Add this line to the top:

    Code:
    <xen:container var="$threadId">{$thread.thread_id}</xen:container>
    
    Now you can use this in logo_block:

    Code:
    <xen:if is="{$threadId} != 1">
    	THIS WILL NOT SHOW IN THREAD_ID 1
    </xen:if>
    
     
    Michael likes this.
  5. Michael

    Michael Active Member

    Thanks a lot :)
     
  6. Michael

    Michael Active Member

    Just so you know this didnt seem to work, I thought it had as it seemed to hide the Adsense ads but it hadnt as Adsense must have just blocked the ads for that page.

    Do you know how I can show some code within create thread only within X forum :D
     
  7. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Same as before, except the xen:container code would go into thread_create instead of thread_view
     

Share This Page