bbPress

Simple, Fast, Elegant

bbPress support forums » Troubleshooting

Sticky on "Latest Discussions"

(2 posts)
  • Started 8 months ago by rolanddeschain
  • Latest reply from livibetter
  • This topic is not resolved
  1. I'd like my sticky threads to act exactly like regular threads on the front page "Latest Discussions" section, instead of always being at the top of the list. That is, they'd still appear on the list, but in the order of last posting - the same as all the usual threads.

    Is there any easy fix?

    Posted 8 months ago #
  2. There are two if blocks in front-page.php, one for $super_stickies, another for $topics. Remove first one(about 8 lines) and replace second with

    <?php
    $stickyIdx = 0; $topicIdx = 0;
    while ($stickyIdx < count($super_stickies) && $topicIdx < count($topics)) {
        if ($super_stickies[$stickyIdx]->topic_time > $topics[$topicIdx]->topic_time)
            array_splice($topics, $topicIdx, 0, array($super_stickies[$stickyIdx++]));
        $topicIdx++;
        }
    if ($stickyIdx < count($super_stickies))
        array_splice($topics, count($topics), 0, array_slice($super_stickies, $stickyIdx));
    
    if ( $topics ) : foreach ( $topics as $topic ) : ?>
    <tr<?php topic_class(); ?>>
        <td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td>
        <td class="num"><?php topic_posts(); ?></td>
        <td class="num"><?php topic_last_poster(); ?></td>
        <td class="num"><small><?php topic_time(); ?></small></td>
    </tr>
    <?php endforeach; endif; // $topics ?>

    Actually, the replacement is equivalent to inserting 8 lines of code.

    Posted 8 months ago #

RSS feed for this topic

Reply

You must log in to post.

Code is Poetry.