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

Brogan

XenForo moderator
Staff member
#3
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

Well-known member
#4
@ChrisW

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.
 

Brogan

XenForo moderator
Staff member
#5
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

Well-known member
#6
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.
 

Brogan

XenForo moderator
Staff member
#7
The error template also needs to be added to the list.

This is what it should look like for the default templates:
HTML:
<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'))">
 

CTXMedia

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

Code:
'Foolbothoneypot_register_form'