XF 1.3 Place an ad after every 5th post


Active member
I posted this in the conditional thread and was told to use xen:calc. Unfortunately there are not a lot of examples of this.

So.. I was curious if anyone knows how to place an ad after every 5th post on a page?

Thanks in advance!


Jake Bunce

XenForo moderator
Staff member
Admin CP -> Appearance -> Templates -> post

Add this code to the top of this template:

<xen:if is="{$post.position} % 5 == 1">
That will hit after every 5 posts, starting with the first post.


Active member
A big thank you to you Jake. That is in the ballpark... it puts it in after 1st post, 6 post, 11 post, 16 post etc.. That will work just fine.
Oddly, my banner server is displaying the same banner in all those spots. That may be something outside of xF though. Thanks again


Active member
No it's my own ads. Fairly odd as it is just an html image tag and hyperlink. I suspect caching as I have a lot of that going on.


Active member
I figured out my caching issue - that is, I have a solution that works - I simply added a dummy variable to the end of the HREF and IMG tag that have the post position number - that way - each banner has different code - does not get cached - and loads.