Adding A Recently Posted Thread Class

Harrie

Member
Hey all - we're planning to transfer our board over to Xenforo in the next 6 months or so, and I'm working on creating a theme for us in advance of our move.

One thing we would like to do is highlight threads which have been posted within the last x days - ours is a creator focused board, so we'd like to make it easier for new content creators to get seen.

I'm primarily familiar with CSS so the template syntax is a little hard for me to use - but I've added a marker for hot threads easily enough with
Code:
<div class="structItem structItem--thread {{ $thread.reply_count >= '50' ? 'hot' : '' }} [...]

Is there something similar I could do to check for days since first posted?
 
Figured it out!

If anybody would like to do the same thing, the variables you need are $xf.time and $thread.post_date.

They render time in seconds since 1/1/1970, so
Code:
{{ $xf.time - $thread.post_date <= '2592000' ? 'new' : '' }}
Will give you how long in seconds since the thread was posted, and then you can set 2592000 to however many days in seconds you want (thats 30).
 
For future reference, if you require specific support, you will need to associate your forum user name with your license, then you can post in the customer forums.
 
Top Bottom