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

XF 1.1 How to exclude content from home page

System0

Active member
#1
I'm using the ad_above_content template to display a 728x90 banner above my threads and forum lists. Unfortunately, this also places the banner on the home page just above the forum list and displays the banner over the sidebar.

(I do think that this needs to be addressed. Perhaps another ad template needs to be created because on all pages the area above the content spans the full length of the page whereas the home page has the sidebar. )

I know that this can be done using if statements but I'm unsure as to how to call the home page template.

Does anyone know the if statement that I need to use in order to exclude content that is placed there with the ad_above_content template.

Thanks,
Kevin
 

System0

Active member
#3
Thanks Brogan. Worked a charm.

Though I noticed some other pages such as the member list that have a sidebar too. Is there a way to only show the ad on pages with no sidebar.
 

Brogan

XenForo moderator
Staff member
#4
There isn't a way of automatically excluding it from all pages with a sidebar as there is no common reference; you will need to add each template into the conditional statement.
 

System0

Active member
#5
ok. I can just add a template to the if statement whenever I find one :)

I tried this but it didn't work. Any ideas what I did wrong?

PHP:
<xen:if is="{$contentTemplate} != 'forum_list' OR {$contentTemplate} != 'member_list'">
 

Rob

Well-known member
#6
Try this (hope my syntax is correct)

Code:
<xen:if is="!({$contentTemplate} == 'forum_list' OR {$contentTemplate} == 'member_list')">
 

System0

Active member
#10
Code:
<xen:if is="!{$sidebar}">
That may work, depending on the template you're trying it in.
That worked great Mike. I've replaced Brogans suggestion (which also worked) with your code as it's simpler and will ensure that the ad will never be posted on any page with a sidebar.