MyBB Community Forums

Full Version: change bgcolor / font of sticky threads on forumdisplay
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello.

Since there doesn't appear to be a plugin to change the color of the Announcements and the Sticky Threads in the forumdisplay, I decided to use template edits.

I successfully changed the color of the Forum Announcements that appear when you view the forumdisplay (any specific forum's page with thread listing, etc). This was located in Templates > Default > Forum Display > forumdisplays_announcements_announcement.

However, I can not find the location of code (in any template) that references the Sticky Threads, because I'd love to wrap it in <span style="color:green"> or something of that sort. Big Grin

Any help, pretty please?
In your global.css file, use this class: forumdisplay_sticky. So for instance, this would make it red with green text:

.forumdisplay_sticky {
color: green;
background: red;
}

For reference, the regular threads are .forumdisplay_regular.

Hope this helps. Smile
(2012-11-16, 10:47 AM)Seabody Wrote: [ -> ]In your global.css file, use this class: forumdisplay_sticky. So for instance, this would make it red with green text:

.forumdisplay_sticky {
color: green;
background: red;
}

For reference, the regular threads are .forumdisplay_regular.

Hope this helps. Smile

Thank you and +1 for the help.

That worked, although I'm puzzled. I have searched through virtually every template and I don't see a class or ID of forumdisplay_sticky being called anywhere?

Btw, your code worked (sort of), it did allow me to change the background color - which was my primary goal. However, it did not (and will not) allow me to change the font color.

This really shouldn't bother me except for my obsessive-compulsive side that won't rest until I have an answer.
{$thread_type_class} variable is defined in forumdisplay.php

	if($thread['sticky'] == 1)
		{
			$thread_type_class = " forumdisplay_sticky";
		}
		else
		{
			$thread_type_class = " forumdisplay_regular";
		}

and if thread is sticky that variable will apply forumdisplay sticky class to sticky thread (forumdisplay_regular if thread is not sticky).
Try this for the active links:

td.forumdisplay_sticky a{
color:orange;
}
(2012-11-16, 11:53 PM)Johnny S Wrote: [ -> ]{$thread_type_class} variable is defined in forumdisplay.php

	if($thread['sticky'] == 1)
		{
			$thread_type_class = " forumdisplay_sticky";
		}
		else
		{
			$thread_type_class = " forumdisplay_regular";
		}

and if thread is sticky that variable will apply forumdisplay sticky class to sticky thread (forumdisplay_regular if thread is not sticky).

Do I smell a free plug-in with a side order of fries? Big Grin

(2012-11-17, 01:07 AM)Leefish Wrote: [ -> ]Try this for the active links:

td.forumdisplay_sticky a{
color:orange;
}

I gave it a shot. It's a step in the right direction. However, what I really wanted to achieve was to make the Thread Subject (of Stickies) a chosen color. That changed all text (that were anchors) to that particular color. The issue is asthetic because for instance "Replies" is a link and "View" is not, so one font was orange and the other was black.

Not the approach I was going for, but an interesting idea, nonetheless.
You can specify it by giving the thread subject a class as well, either by stepping through the css or cheating and putting a span class on it. Do you have firebug or dragonfly? If you use either of those you can inspect the css and apply the right style.

Something like this would never need to be a plugin in my opinion, you can do it with template edits and css.
(2012-11-17, 01:52 AM)Leefish Wrote: [ -> ]You can specify it by giving the thread subject a class as well, either by stepping through the css or cheating and putting a span class on it. Do you have firebug or dragonfly? If you use either of those you can inspect the css and apply the right style.

Something like this would never need to be a plugin in my opinion, you can do it with template edits and css.

I agree. That is the technique that I used for announcement threads. But sticky threads are not differentiated in a template anywhere (that I can find, and I have looked, extensively). In fact, this question "what template do I do this in?" was posed in this thread and a response came that this would have to be done in a php file.

If I can successfully modify a template and its associated CSS please tell me which one and I would blissfully use that technique.

To be clear, what I want to do is:

Customize the Thread Subject (only) of sticky threads, such that on all forum display pages, they appear in a chosen color. (background and font colors)

I achieved this easily for announcements using template edits and css as recommended.
Are you using firebug to inspect the page?

A sticky thread is a thread. Wrap the thread subject in a span class and target the span inside the td.forumdisplay_sticky in css.
(2012-11-17, 11:15 AM)Leefish Wrote: [ -> ]Are you using firebug to inspect the page?

A sticky thread is a thread. Wrap the thread subject in a span class and target the span inside the td.forumdisplay_sticky in css.

No, I've not heard of firebug or dragonfly, I will look them up as they sound like useful tools. Thank you.

When you say wrap the thread subject in a span class, do you mean on the front end when I post a thread, enable html so I can add the style tag there right in the subject line?

I apologize for my confusion! Confused

Could you post the code you would use? Would I add it around a thread title when posting a thread? Or would I add it around a certain section of code in a particular template? It sounds like what you are suggesting will work, I just can't visualize all the steps...

Toungue
Pages: 1 2