Skip to:
Content
Pages
Categories
Search
Top
Bottom

Sticky on “Latest Discussions”

  • @rolanddeschain

    Member

    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?

Viewing 1 replies (of 1 total)
  • @livibetter

    Member

    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.

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar