XF 1.1 excluding ads from forum home page.

ChrisW

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

Thanks
Chris.
 
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))">
 
@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.
 
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.
 
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.
 
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'))">
 
Top Bottom