Not Planned Add total likes to thread info in the discussion list

cannabis ape

Customer
I still don't get why XF don't have an option for this in the core but yeah I'm a fan of it.

To illustrate I added destop and mobile version. Seems easy enough although I haven't figured it out yet so if you could point me in the right way that would be great.

likes.png
mob.jpg
 

Russ

Pixel Exit Staff
I don't believe total likes are exposed in threads. I can only see the first post-reaction score.

You can use it in the template: thread_list_macros

Code:
First post likes: {$thread.first_post_reaction_score|raw}
I'm assuming to get the total likes in a thread on that page you'd need an add-on. I could be wrong though....
 

cannabis ape

Customer
I don't believe total likes are exposed in threads. I can only see the first post-reaction score.

You can use it in the template: thread_list_macros

Code:
First post likes: {$thread.first_post_reaction_score|raw}
I'm assuming to get the total likes in a thread on that page you'd need an add-on. I could be wrong though....
Yesh, I meant the total score of the first post
 

cannabis ape

Customer
I don't believe total likes are exposed in threads. I can only see the first post-reaction score.

You can use it in the template: thread_list_macros

Code:
First post likes: {$thread.first_post_reaction_score|raw}
I'm assuming to get the total likes in a thread on that page you'd need an add-on. I could be wrong though....
I can't get the right code, I was able to get the word at that position but when I try to show reaction I get an syntax error, tried several codes but haven't found the right one yet.

Code:
<dl class="pairs pairs--justified structItem-minor">
                <dt>{{ phrase('likes') }}</dt>
                <dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.reaction_count > $thread.reaction_count ? $thread.first_post_reaction_score|raw }}</dd>
            </dl>
 

Russ

Pixel Exit Staff
Code:
What are you trying to do here: {{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.reaction_count > $thread.reaction_count ? $thread.first_post_reaction_score|raw }}
Can you just replace it with:

Code:
{$thread.first_post_reaction_score|raw}
?
 

cannabis ape

Customer
Code:
What are you trying to do here: {{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.reaction_count > $thread.reaction_count ? $thread.first_post_reaction_score|raw }}
Can you just replace it with:

Code:
{$thread.first_post_reaction_score|raw}
?
What I was trying to do is get the word likes under views in the same size and then show the amount behind it it the same size as the view numbers. I was able to get the word likes there but not the count.

If I only paste
Code:
{$thread.first_post_reaction_score|raw}
It just shows the number
 

Russ

Pixel Exit Staff
Find this bit inside template: thread_list_macros (around line 171)

Code:
            <dl class="pairs pairs--justified structItem-minor">
                <dt>{{ phrase('views') }}</dt>
                <dd>{{ $thread.discussion_type == 'redirect' ? '&ndash;' : ($thread.view_count > $thread.reply_count ? $thread.view_count|number_short : number_short($thread.reply_count+1)) }}</dd>
            </dl>
Add this after it
Code:
            <dl class="pairs pairs--justified structItem-minor">
                <dt>First post reactions</dt>
                <dd>{$thread.first_post_reaction_score|raw}</dd>
            </dl>
Results in:



Screenshot_10.png
 

Russ

Pixel Exit Staff
Try this in extra.less:

Code:
.XenBase .structItem-cell.structItem-cell--meta .structItem-minor { display: block; }
 

Pre-Sale Questions

If you have any questions or concerns you want to ask before you make a purchase don't hesitate to use one of our multiple support channels for your convenience.