• You need 5 posts to download resources. You can only download 2 resources per day. To remove these limits consider upgrading.

XF [JoyFreak] Thread view/reply count

Nick

Developer
Banned User
LV
0
 
Joined
Feb 7, 2023
Messages
491
Reaction score
128
Awards
14
Description
This guide will run you through on how to display the number of views and replies in the thread description.

Guide
 

Go to Admin CP > Appearance > Templates > Search: thread_view

Find:

Code:
<a href="{{ link('threads', $thread) }}" class="u-concealed"><xf:date time="{$thread.post_date}" /></a>
        </li>
Add below (choose one from below):

Full number, without comma:

Code:
 <li title="Replies">
            <i class="fa--xf far fa-reply" aria-hidden="true" title="Replies"></i>
            <span class="u-srOnly">{{ phrase('replies') }}</span>
            {$thread.reply_count}
        </li>

        <li title="Views">
            <i class="fa--xf far fa-eye" aria-hidden="true" title="Views"></i>
            <span class="u-srOnly">{{ phrase('views') }}</span>
            {$thread.view_count}
        </li>


Full number, with comma:

Code:
 <li title="Replies">
            <i class="fa--xf far fa-reply" aria-hidden="true" title="Replies"></i>
            <span class="u-srOnly">{{ phrase('replies') }}</span>
            {$thread.reply_count|number}
        </li>

        <li title="Views">
            <i class="fa--xf far fa-eye" aria-hidden="true" title="Views"></i>
            <span class="u-srOnly">{{ phrase('views') }}</span>
            {$thread.view_count|number}
        </li>


Short number:

Code:
 <li title="Replies">
            <i class="fa--xf far fa-reply" aria-hidden="true" title="Replies"></i>
            <span class="u-srOnly">{{ phrase('replies') }}</span>
            {$thread.reply_count|number_short}
        </li>

        <li title="Views">
            <i class="fa--xf far fa-eye" aria-hidden="true" title="Views"></i>
            <span class="u-srOnly">{{ phrase('views') }}</span>
            {$thread.view_count|number_short}
        </li>


Screenshot
Full number, without comma

image.png

Full number, with comma

image.png

 
Last edited by a moderator:
Top