tohaitrieu
Active member
Hi every body
This is my custom code to set the first attactment as thread cover and show View count in The First Post.
1. Set the first attactment as thread cover (featured picture)
Open post_macros template, search:
Add Above:
2. Show Thread View count
In the same post_macros template, search:
Add Bellow:
Live demo at: https://fx.tohaitrieu.net
Screenshoot:
Check and give me feed back.
Thank you!
This is my custom code to set the first attactment as thread cover and show View count in The First Post.
1. Set the first attactment as thread cover (featured picture)
Open post_macros template, search:
Code:
<span class="u-anchorTarget" id="post-{$post.post_id}"></span>
Add Above:
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == 0">
<xf:if is="{$thread.FirstPost.Attachments.first().thumbnail_url}">
<div class="width: 100%; margin: 0; padding: 0; clear: both;">
<img src="{{ link('canonical:attachments', $thread.FirstPost.Attachments.first()) }}" alt="{$thread.title}" />
</div>
</xf:if>
</xf:if>
2. Show Thread View count
In the same post_macros template, search:
Code:
<a href="{{ link('threads/post', $thread, {'post_id': $post.post_id}) }}" class="u-concealed"
rel="nofollow">
<xf:date time="{$post.post_date}"/>
</a>
Add Bellow:
Code:
<xf:if is="{$post.position} % {$xf.options.messagesPerPage} == 0">
<span><strong><i class="far fa-eye"></i> Lượt xem: {$thread.view_count}</strong></span>
</xf:if>
Live demo at: https://fx.tohaitrieu.net
Screenshoot:
Check and give me feed back.
Thank you!