• Skip to main content
  • Skip to primary sidebar

xfpoint

XenForo Resource Site with Tips, Tricks and Hacks

  • Home
  • About
  • Glossary
  • Guides
  • Tutorials
  • Add-ons
  • Contact
You are here: Home / Tutorials / How To Show Ads Only on the Homepage in XenForo?

How To Show Ads Only on the Homepage in XenForo?

April 12, 2017 by Shabbir Bhimani

To show ads only on the homepage can vary based on how you wish to show them – using an ad manager addon or by modifying the template.

Let me share both the options to show ads only on the homepage.

In either case, we need to know what is the name of the content template name used for the homepage.

How to Find Homepage Content Template Name?

Normally you can set up any page as homepage in XenForo and if you have done that, the content template will change.

If you are on default homepage with a list of forums and sub forums being displayed the template is “forum_list”.

If you have custom home page, the template name can be fetched from the source code of the HTML.

Look for the div with id=”content”. The class name of that div is the name of the content template.

Ideally, for forum_list homepage, it will be

<div id="content" class="forum_list">
view raw homepage.html hosted with ❤ by GitHub

So content template name is forum_list. If you are using XenPorta 2‘s list of articles as a homepage, the content template name will be “EWRporta2_ArticleList”. On my DIYTechnicalAnalysis forum we have timeline as the homepage and so the content template is from the timeline plugin which is “timeline_wrapper”.

Once we have the name of the content template, we can use either the ad manager or template conditions to show ads only on the homepage.

Using Ad Manager to show ads only on homepage

There are numerous addons for managing ads in XenForo and by far the best and most comprehensive one is Ad Manager By Siropu.

Within the ad manager, look for the “Page Criteria” tab and within the tab look for the “Page Information” section in which you will find the “Content Template is” checkbox.

Enable the checkbox and in the text field enter the homepage template name. In the screenshot above I have entered “forum_list”. The ad will only show on the homepage at the required position and based on the other criteria selected.

Using template code to show ads only on homepage

We have a long list of templates where we can place an ad.

You can select any one of the above templates or can use any custom placement within the PAGE_CONTAINER template. The code will remain the same.

To show the ad only on the home page, use the Xen if conditional code as follows

<xen:if is="{$contentTemplate} == 'forum_list'">
<!-- Ad banner code start -->
<!-- Ad banner code end -->
</xen:if>
view raw ads-only-on-homepage.html hosted with ❤ by GitHub

If your homepage template is different from forum_list, change accordingly.

Share this:

  • Click to share on Twitter (Opens in new window)
  • Click to share on Facebook (Opens in new window)
  • Click to share on WhatsApp (Opens in new window)
  • Click to share on LinkedIn (Opens in new window)

Filed Under: Tutorials Tagged With: Ad Manager, Ads, Template, Xen Conditional

About Shabbir Bhimani

xfpoint.com is an independent XenForo resource site with tips, tricks, hacks, and resources for new XenForo webmasters to improve their community. Read More…

Primary Sidebar

About Shabbir Bhimani

xfpoint.com is an independent XenForo resource site with tips, tricks, hacks, and resources for new XenForo webmasters to improve their community. Read More…

© xfpoint 2025. xfpoint.com is an independent XenForo resource site for new xenForo webmasters.

Copyrighted code samples of XenForo will be visible only if you have a valid xenForo license.