yoghurtfarmer
Well-known member
Update: Thread has been updated with instructions for in post advertisements: see this post.
1. Create a template for each ad you will place.
I recommend this over placing the code directly in PAGE_CONTAINER or forum_list because it's much more manageable if you ever need to edit or change your ad. Xenforo also has a spectacular feature of showing which other templates have been included when you view a template.
On my site http://www.forumvancouver.com/, I have 3 ads at the moment. The bolded names are the template names I chose.
Top Leaderboard (adsense_top) - Above top breadcrumb and below navbar
Wide Sidetower (adsense_tower) - On the sidebar at the bottom
Bottom Leaderboard (adsense_bottom) - Above bottom breadcrumb
2. Fill in the template with your ad code along with any conditions and CSS.
For instance in adsense_top I have the following. The margin is to ensure that the search box doesn't overlap the ad when the window is resized smaller.
For adsense_bottom, I only want them to be shown to guests, so I put everything in between <xen:if is="!{$visitor.user_id}"></xen:if>
3. Use the include function to place your ads in the appropriate template/spot
Place <xen:include template="TEMPLATE NAME" /> where you want your ad to be.
In the template PAGE_CONTAINER:
In the template forum_list:
Note that the way I've done this incorporates adsense_tower only on the main page and the leaderboards to EVERY page on the forum.
There are likely more conditions that you can add to limit what type of page the ads show up on, so if you figure them out, do share!
1. Create a template for each ad you will place.
I recommend this over placing the code directly in PAGE_CONTAINER or forum_list because it's much more manageable if you ever need to edit or change your ad. Xenforo also has a spectacular feature of showing which other templates have been included when you view a template.
On my site http://www.forumvancouver.com/, I have 3 ads at the moment. The bolded names are the template names I chose.
Top Leaderboard (adsense_top) - Above top breadcrumb and below navbar
Wide Sidetower (adsense_tower) - On the sidebar at the bottom
Bottom Leaderboard (adsense_bottom) - Above bottom breadcrumb
2. Fill in the template with your ad code along with any conditions and CSS.
For instance in adsense_top I have the following. The margin is to ensure that the search box doesn't overlap the ad when the window is resized smaller.
Code:
<div style="text-align: center; margin-top:8px;">
GOOGLE ADSENSE CODE GOES HERE
</div>
For adsense_bottom, I only want them to be shown to guests, so I put everything in between <xen:if is="!{$visitor.user_id}"></xen:if>
Code:
<xen:if is="!{$visitor.user_id}">
<div style="text-align: center; padding: 7px;">
GOOGLE ADSENSE CODE GOES HERE
</div>
</xen:if>
3. Use the include function to place your ads in the appropriate template/spot
Place <xen:include template="TEMPLATE NAME" /> where you want your ad to be.
In the template PAGE_CONTAINER:
For adsense_top, I placed it immediately BEFORE
<xen:if is="{$showUpgradePendingNotice}">
For adsense_bottom, I placed it immediately BEFORE
<div class="breadBoxBottom">
In the template forum_list:
For adsense_tower, I placed it immediately BEFORE
</xen:sidebar>
Note that the way I've done this incorporates adsense_tower only on the main page and the leaderboards to EVERY page on the forum.
There are likely more conditions that you can add to limit what type of page the ads show up on, so if you figure them out, do share!