XF 2.1 Default advertising system: Is there a way to make ads only show on certain pages?

PumpinIron

Well-known member
Here's the dilemma I face, so bare with me.

The forum in question is https://wranglertjforum.com

I have an Amazon banner and Amazon native shopping ads that show up at the bottom of forum overview, forum view, and thread list.

Here's an example:

Screen Shot 2020-03-08 at 8.31.29 AM.png

To accomplish this, this is what my advertising setup looks like:

Screen Shot 2020-03-08 at 8.32.15 AM.png

The issue I have with this is that for the ads on the page, I'd rather them show up BELOW the container breadcrumb bottom.

However, if I insert the ad code in the container breadcrumb bottom (below) section, then those ads show up on every single page in the site (i.e. conversations, members, etc.), whereas I only want them to show up on forum overview, forum view, and thread list.

I tried using conditional code in the container breadcrumb bottom (below) section that would only show the ads if the person was on forum overview, forum view, or thread list, but it didn't seem to work.

Can anyone tell me if there is a way to accomplish this without a third party add-on? I actually really like the built-in advertising system, it's just a bit annoying having ads show up before the reply area, as people have to scroll further to find where to reply.

Maybe @Chris D knows?

Thanks in advance!
 

Russ

Well-known member
Code:
<xf:if is="$xf.reply.template == 'thread_view'">
  ad code
</xf:if>

You can find the template name by inspecting the source of the page at the top:
Screenshot_2.png

Should work in the ad templates.
 

PumpinIron

Well-known member
Thanks, that did the trick. I must have been writing the XF code wrong, because I swear I tried this before and it didn't work.

What if I wanted to include forum_list, forum_view, and thread_view all in one IF statement? How would that look?
 
Top