XF 2.3 How do I modify Trending content widget?

kb87

New member
Licensed customer
I want it to show the most recent post date for each thread..not the he original posting date of the thread.
 
The Trending content widget uses the widget_trending_content template to render each item. By default, it displays the thread's creation date ($thread.post_date). To show the most recent post date instead, you need a template modification.

Go to Admin Panel > Appearance > Template modifications and create a new one:

Template:widget_trending_content
Search type: Regular expression
Find:
\$thread\.post_date
Replace:
$thread.last_post_date

The last_post_date field is already available on the thread entity — it stores the timestamp of the most recent reply. So the replacement should work without any additional data fetching.

If the template uses <xf:date> or {{ date() }} to format the date, just swap the variable inside the function call while keeping the formatting the same.

One thing to note — if you're using the default XenForo 2.3 trending widget, first inspect the actual template name by hovering over the widget with debug mode on (add ?_debug=1 to the URL). The template name may differ slightly depending on your version.
 
Back
Top Bottom