No announcement yet.

How does one exclude category, forum, threads from showing google adsense?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How does one exclude category, forum, threads from showing google adsense?

    Ok My objective is to exclude a category/forums and its threads from serving up google adsense using the ad manager in 4.22.
    Some of the content in this forum doesnt meet their advertizing policy guidelines.
    Ive tried several different ways using my (Extremely) limited knowledge of conditionals.
    Bear in mind I'm no coder by any stretch. I tried making a new ad block as a global footer <vb:if condition="$forum[forumid] != x">Show this if forum id is not x</vb:if>
    this but it wont work for more than 1 forum. and not the one excluded.
    This was my last attempt with some degree of success. (it doesnt work in the threads
    and all the forums.
    Here is the code I last used
    <if condition="$global[form id]=1 AND !in_array($forumid, array(1,2,8,18))">
    <p align="center">
    <center><script async src="//"></script>
    <!-- 728x90, created 3/23/10 -->
    <ins class="adsbygoogle"
    (adsbygoogle = window.adsbygoogle || []).push({});
    <script async src="//"></script></center>
    Can any of you coders look at this and tell me the best way to do this? Thanks in advance for any direction here.

  • #2


    • #3

      <if condition="$global[form id]=1 AND !in_array($forumid, array(1,2,8,18))"> Change it too <if condition="!in_array($GLOBALS[forumid], array(1,2,8,18))">


      • #4

        Thank You Zachary - limited success. Got it to work in one forum category but for whatever reason it wont hold the toggle. User is browsing forum fishermans lounge or one of its child forums
        unable to add more without database errors or screwy layouts. it reverts back to no checks on the toggles ​
        <if condition="!in_array($GLOBALS[forumid], array(1,2,8,16,17,18,19,84))">content here(adsense code)</p></if>

        Perhaps I can add the content to s template? someplace and if i can which one? and where?


        • #5
          No where else - and cant add more


          • #6
            If this is VB 4.2.2 you need to be using the

            <vb:if> syntax not <if> syntax

            Child forums are not counted - you need the forumid of every single forum (subforum or not) in the array.

            That could mean hundreds of forumids if that is how many forums are in the categories you don't want.

            Obviously that isn't practical... if you have that many forums you want covered I would suggest making a custom plugin that can check the parentids of a forum to determine where it is. For custom coding issues please check on


            • #7
              thank you - That worked. Although its a tempermental system.
              It takes repeated tries. I only have 1 forum with 6 or 7 subforums I want excluded.
              The b*itch would be to add custom non adsense ads to those forum and not show them in the others. Thats a challenge. lol for a custom mod


              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.