XF 2.1 Widget Display Conditional - not show in particular forums

motowebmaster

Well-known member
I have a template conditional that works:

Code:
<xf:if is="!in_array($forum.node_id, [6,7,40,45])">
ad code ...
</xf:if>

I would like to use something similar for the Widget Display Condition field, so that the widget-block doesn't show up at all. Right now it's showing a blank widget. I've managed to get it to work with other code examples I've found through searches, but not for blocking the widget in specific forums.

Any assistance would be appreciated,
 
You need to use a different var.

Code:
!in_array({$xf.reply.containerKey}, ['node-2', 'node-3'])
At first that didn't work, i didn't realize that var value actually needed the 'node-' portion. I see it in the dump now, my bad.

Anything wrong with using $context.thread.node_id? as in:
Code:
!in_array($context.thread.node_id, [5,16,27])

Say node_id 16 has 3 children, they should inherit the conditional correct? As in, they will be hidden in this case?
 
You can use whatever works and is available to the template you are displaying the widget.

You will have to explicitly use the node IDs.

What about the child nodes question?

Thanks for the speedy replies, it's not the first time you've been right there to help. You need to add a 'Beer Me' link that goes to your PayPal so we can buy you a beer or two 🤘
 
Yes It Is Reaction GIF
 
Back
Top Bottom