• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Adding class to thread item based on node ID and thread count

Case

Active member
#1
Trying to add a class to an existing div in the thread_list_macros template by using {{ $forum.node_id == 34 AND $thread.reply_count > 1 ? 'extra-class' : '' }}

The node_id part isn't working though. Is this possible?
 

Chris D

XenForo developer
Staff member
#2
The thread_list_macros template and item macro is called in a few places -- where are you testing this condition? In most places, the $forum arg is passed in so it should be available.

Does this work any better?
Code:
{{ ($forum.node_id == 34 AND $thread.reply_count > 1) ? 'extra-class' : '' }}
 

Chris D

XenForo developer
Staff member
#4
FWIW you'd probably might as well switch $forum.node_id with $thread.node_id. The node_id value is always available on the thread entity and the thread arg is always passed into this macro. However, there are some lists of threads where we don't pass the $forum arg in.