Highlight threads with polls

PVS

Super Moderator
Thành viên BQT
Tham gia
28/02/2015
Bài viết
17,142
Được Like
12,745
Vnxf.vn - This is a simple template edit which will allow you to highlight threads with polls in the thread list.
Useful if you don't want to use a prefix.

The instructions below apply to XenForo 1.4.
The template code may be different in earlier versions of XenForo, but the principle is the same.

The template you need to edit is the thread_list_item template.


You can of course make the edit wherever you wish in the template - this first example has it before the prefix.

Look for these two lines of code:
Mã:
<xen:if is="{$showSubscribeOptions}"><input type="checkbox" name="thread_ids[]" value="{$thread.thread_id}" /></xen:if>
<xen:if is="{$thread.prefix_id}">

Add the following code between the two lines:
Mã:
<xen:if is="{$thread.discussion_type} == 'poll'">
    Poll
</xen:if>

Like so:
Mã:
<xen:if is="{$showSubscribeOptions}"><input type="checkbox" name="thread_ids[]" value="{$thread.thread_id}" /></xen:if>
[COLOR=#ff8000]<xen:if is="{$thread.discussion_type} == 'poll'">
    Poll
</xen:if>[/COLOR]
<xen:if is="{$thread.prefix_id}">

The result is this:

poll.PNG

Of course you can replace the word 'Poll' with a phrase, an image, style it to suit, etc.


You could even do something like this:

upload_2015-2-14_14-4-4.png

Look for this line of code:
Mã:
<li id="thread-{$thread.thread_id}" class="discussionListItem {$thread.discussion_state}{xen:if '!{$thread.discussion_open}', ' locked'}{xen:if {$thread.sticky}, ' sticky'}{xen:if {$thread.isNew}, ' unread'}{xen:if {$thread.prefix_id}, ' prefix{$thread.prefix_id}'}{xen:if {$thread.isIgnored}, ' ignored'} {xen:if $thread.thread_is_watched, threadWatched} {xen:if $thread.forum_is_watched, forumWatched}" data-author="{$thread.username}">

Add the following code, which adds a new discussionListItemPoll class:
Mã:
{xen:if "{$thread.discussion_type} == 'poll'", ' discussionListItemPoll'}

Like so:
Mã:
<li id="thread-{$thread.thread_id}" class="discussionListItem {$thread.discussion_state}{xen:if "{$thread.discussion_type} == 'poll'", ' discussionListItemPoll'}{xen:if '!{$thread.discussion_open}', ' locked'}{xen:if {$thread.sticky}, ' sticky'}{xen:if {$thread.isNew}, ' unread'}{xen:if {$thread.prefix_id}, ' prefix{$thread.prefix_id}'}{xen:if {$thread.isIgnored}, ' ignored'} {xen:if $thread.thread_is_watched, threadWatched} {xen:if $thread.forum_is_watched, forumWatched}" data-author="{$thread.username}">

Then add the class to the EXTRA.css template with the styling you wish:
Mã:
.discussionListItemPoll
{
    border: 1px solid orange !important;
}

Or combine the two:

1upload_2015-2-14_14-4-4.png

As you can see, there are numerous possibilities.

Just use this as a guide to achieve the result you want.


Nguồn: xenforo.com​
 
  • Like
Reactions: THB

Top Bottom