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

XF 1.1 excluding ads from forum home page.

Discussion in 'Styling and Customization Questions' started by ChrisW, Jul 19, 2013.

  1. ChrisW

    ChrisW Member

    I've added ad code to ad_above_content template, how can I stop ads appearing on the forum home page?

  2. Brogan

    Brogan XenForo Moderator Staff Member

    ChrisW likes this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    If you are excluding from more than one template, use an array.

    <xen:if is="!in_array({$contentTemplate}, array('register_form', 'forum_list', 'resource_index))">
    Bram likes this.
  4. Bram

    Bram Well-Known Member


    In case you are using Adsense make sure to add the following templates as well to avoid issues with Google ToS

    <xen:if is="!in_array({$contentTemplate}, array('search_form_post', 'search_results', 'register_form', 'login', 'error_with_login'))">

    Especially login and search results for ads above the fold seem to be an issue for them.
    ChrisW likes this.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    Don't forget the other search forms - there are three default ones: search_form, search_form_post and search_form_profile_post.

    Plus any additional ones from add-ons, for example search_form_resource_update, xengallery_search_form_media, etc.
    Bram and ChrisW like this.
  6. Bram

    Bram Well-Known Member

    Can these templates be excluded by default in a future version of XF when using adsense blocks @Mike.

    I only found out because Google gave me a headsup about it (warning!) and it would be a shame to see XF users being banned from Adsense because most people probably don't know. Its especially an issue when using the ad_above_content template.
  7. Brogan

    Brogan XenForo Moderator Staff Member

    The error template also needs to be added to the list.

    This is what it should look like for the default templates:
    <xen:if is="!in_array({$contentTemplate}, array('error', 'search_form', 'search_form_post', 'search_form_profile_post', 'search_results', 'register_form', 'login', 'error_with_login'))">
  8. CyclingTribe

    CyclingTribe Well-Known Member

    If you have the FoolBotHoneyPot add-on installed, add this to your array too:


Share This Page