Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
coding-topic
Manually divide pinned from normal topics
Avatar
Kilomoana
Member
Free Members
Offline
Jan 12, 2013 - 6:19 am

Hi there,

 

is there a way to divide pinned topics from normal ones? Maybe with to loops in the spForumView?

 

I would like to display the pinned topics with a different header.

 

Greetings

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Jan 12, 2013 - 3:31 pm

you could do multiple loops...  you could use a filter to change the query for first loop to only give you pinned topics and the filter the query again on second loop to only get non pinned topics..

or maybe use some CSS since pinned topics have their own class applied... so you could highlight the pinned topic in different color, or add a border on bottom of last one...

lots of options really...

Avatar
Brandon
U.S.
SP Wrangler
Free Members
Offline
Jan 12, 2013 - 6:37 pm

There is actually a pretty easy way now. You can use CSS to color the actual forum topic section to a different color if a topic is pinned. You do so using the spPinnedTopic class.

Something like

.spForumTopicSection.spPinnedTopic {
    background: #color !important;

Then if you want a header above and below the pinned topics you could do this at the start of the topic display loop in soForumView.php

screenshot_12.pngImage Enlarger
 
 
At the end of the loop add something like this:
screenshot_01.pngImage Enlarger
 
To give you something like this. smile
screenshot_02.pngImage Enlarger
 
Avatar
Robb G
Member
Offline
Jan 12, 2013 - 11:34 pm

Brandon C said
There is actually a pretty easy way now. You can use CSS to color the actual forum topic section to a different color if a topic is pinned. You do so using the spPinnedTopic class.

Something like

.spForumTopicSection.spPinnedTopic {
    background: #color !important;

In which file would I put that code above? And does placement matter?

 
 

 

Avatar
Brandon
U.S.
SP Wrangler
Free Members
Offline
Jan 13, 2013 - 12:06 am

Robb G said In which file would I put that code above? And does placement matter?

There are several ways and places you can add it. If you have a custom Simple:Press theme you can add it to the bottom of your theme's php file or CSS file. If not running a custom theme you can even put it in the forum page itself by adding it manually to the page.

For example if you go to your forum page in WordPress and add this to it in text/problem-with-post-edit-buttontml mode only..

<style media="screen" type="text/css">
.spForumTopicSection.spPinnedTopic {
 background: #color !important;
</style>

It will add that CSS to your forum page when it loads. Lots of ways to do it but the most efficient is having a custom SP theme and adding it to that. 

 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Jan 13, 2013 - 9:50 am

nice!

Avatar
Robb G
Member
Offline
Jan 13, 2013 - 3:54 pm

Thanks. I followed your instructions and it worked. I used my custom theme. With this, I don't really need the featured topics plugin.

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
Offline
Jan 13, 2013 - 6:43 pm

cool... enjoy!

Avatar
Kilomoana
Member
Free Members
Offline
Jan 14, 2013 - 7:32 am

Thank you very much, it helped a lot.

Avatar
Yellow Swordfish
Glinton, England
SP Master
Offline
Jan 14, 2013 - 8:12 am

You're welcome.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626