XF 2.1 If statements for custom code if on page X of thread Y


Active member
Could anyone advise on an efficient conditional statement for post macros?

I want to be able to feed in possibly hundreds of thread IDs and Pages as google adsense is always finding violations with thousands of posts a day, so would just be easier to disable adverts on these pages.

Not sure the best way to do it without having a performance hit.

This is the current statement

Thanks :)

<xf:if is="($post.position % $xf.options.messagesPerPage) == 13">

Would ideally like to pass in pairs of thread ids and pages that could manage them getting quite long

Last edited:


Active member
Anybody? There's code like this but it needs to be two dimensional to not show depending on the page ID

<xf:if is="in_array($post.Thread.thread_id, [4,6,8])">
Place AD Code here