Support Forum

Manually divide pinned from normal topics

KI Kilomoana
Kilomoana
Member

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

9 Answers

New Answer

MP Mr Papa
Mr Papa
Member

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…

BR Brandon
Brandon
Member

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.png
 
 
At the end of the loop add something like this:
screenshot_01.png
 
To give you something like this. smile
screenshot_02.png
 
RG Robb G
Robb G
Member

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?

 
 

 

BR Brandon
Brandon
Member

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. 

 

RG Robb G
Robb G
Member

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