Skip to:
Content
Pages
Categories
Search
Top
Bottom

Separating the first post of each topic

  • Hi!

    I want to separe the first post of each topic from the loop ol list but I can find out how. In topic.php here;

    <ol id="thread" start="<?php echo $list_start; ?>">

    <?php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?>

    <li id="post-<?php post_id(); ?>"<?php alt_class('post', $del_class); ?>>

    <?php bb_post_template(); ?>

    </li>

    <?php endforeach; ?>

    </ol>

    I’d like to change the loop so I can insert a h6 header after the first post and threads look like this;

    h6 -> “Topic title”

    First post

    h6 -> “Responses; “

    ol li -> rest of the posts

    Is it possible to build a custom loop that only shows the first post and then insert a second loop for the rest of the post with an offset of 1?

Viewing 3 replies - 1 through 3 (of 3 total)

  • Ben L.
    Member

    @nightgunner5

    Untested code below:

    <?php $bb_post = $posts[0]; unset($posts[0]);   $del_class = post_del_class();?>
    <div id="post-<?php post_id(); ?>"<?php alt_class('post', $del_class); ?>>
    <?php bb_post_template(); ?>
    </div>
    <h6>Responses</h6>
    <ol id="thread" start="<?php echo $list_start; ?>">
    <?php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?>
    <li id="post-<?php post_id(); ?>"<?php alt_class('post', $del_class); ?>>
    <?php bb_post_template(); ?>
    </li>
    <?php endforeach; ?>
    </ol>

    Hi nightgunner!

    Thanks for the code :) It works great.


    Derek Herman
    Member

    @valendesigns

    AWESOME!!!!!!! That’s all I can say.

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