Info
- 4 posts
- 3 voices
- Started 3 years ago by ganzua
- Latest reply from Derek Herman
- This topic is not resolved
Separating the first post of each topic
-
- Posted 3 years ago #
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?
-
- Posted 3 years ago #
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> -
- Posted 3 years ago #
Hi nightgunner!
Thanks for the code :) It works great.
-
- Posted 2 years ago #
AWESOME!!!!!!! That's all I can say.
-
You must log in to post.