MyBB Community Forums

Full Version: Sticky & closed thread icons on forumdisplay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey guys,

For the theme I'm currently creating, I would like to have icons displayed on the forumdisplay page to indicate when a thread is stuck or closed, like XenForo:
[Image: xenforo_zpsa9c81b05.png]
Normally, I would do this using the php in templates plugin from mybbhacks, and put something like this in the templates:
<if $thread['sticky'] then><img src="pathtostickyicon" /></if>
<if $thread['closed'] then><img src="pathtoclosedicon" /></if>

However, since I'm planning to publicly release this theme, I can't use this plugin in it for copyright reasons.

How to put this in javascript or something, that can also be used in the templates without the need for core file edits? Any help would be greatly appreciated.

Thanks in advance Smile
Simple PHP/CSS "hack":
<img src="pathtostickyicon" class="thread_sticky_{$thread['sticky']}" />
<img src="pathtoclosedicon" style="display: none;" class="thread_closed_{$thread['closed']}" />

Then in global.css:
.thread_sticky_0 {
    display: none;
}

.thread_closed_1 {
    display: inline !important;
}
Is it really that simple?

I'll try it. Thanks.

EDIT: It works! Thanks. +1