XF 2.2 Widget in one specific thread?

Svoboda

Active member
Is it possible to place a widget in a specific thread?

I tried using !$xf.thread.thread_id == X in the display conditions box but that doesn't seem to work as it just shows up in every thread.
 
Solution
Single thread:
Code:
$xf.reply.contentKey == 'thread-24'

Multiple threads:
Code:
in_array($xf.reply.contentKey, ['thread-10','thread-24'])

Change the thread ID as required.

Harvey

Active member
Multiple threads:
Code:
in_array($xf.reply.contentKey, ['thread-10','thread-24'])

Change the thread ID as required.
I am having trouble adding another thread to this:

Code:
<xf:if is="$xf.reply.template == 'thread_view' && $xf.reply.contentKey != 'thread-2'">

and this

Code:
<xf:if is="$thread && $thread.thread_id != 2">

Adsense is making life difficult. If the first post on a new page is only one sentence I get a "must fix" violation. It's like PLEASE give it some time, so someone else can post on that page too.

ETA: this should be the last time I ask for the help. Once I have two threads in each spot, the method for adding more will be obvious.
 
Last edited:

Harvey

Active member
I found this thread and I think was able to figure it out:


Code:
<xf:if is="in_array($xf.reply.template == 'thread_view' && $xf.reply.contentKey != 'thread-2','thread-705')">

Code:
<xf:if is="in_array($thread && $thread.thread_id != 2,705)">

Thank you.
 

Harvey

Active member
I found this thread and I think was able to figure it out:


Code:
<xf:if is="in_array($xf.reply.template == 'thread_view' && $xf.reply.contentKey != 'thread-2','thread-705')">

Code:
<xf:if is="in_array($thread && $thread.thread_id != 2,705)">

Thank you.
I am wrong this didn't work. It is blocking the ad units from appearing in EVERY thread. Could you help me?
 

Jeremy P

XenForo developer
Staff member
That condition would only display in regular threads with the IDs 2 and 705, so it wouldn't display in any other thread. Is that what you wanted?
 
Top