Info
- 2 posts
- 1 voice
- Started 3 years ago by aquagrrl
- Latest reply from aquagrrl
- This topic is not resolved
Additional Info on Lastest Discussions
-
- Posted 3 years ago #
I'm trying to come up with a way to show additional information on the lastest discussions on the front page. I want to show the topic author's avatar, name, title, the date it was first posted, and the forum it is in. I found some author functions in the post.php, but I think I need to make them within a post loop calling only the firs post. I haven't figured out how to do that or how the topics.php is doing it.
Here is what I've tried so far:
'<?php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?></p>- <?php post_author_avatar(); ?>
- <?php post_author_link(); ?>
- <?php post_author_title(); ?>
- <?php printf( __('Posted %s ago'), bb_get_post_time() ); ?>
<p> <?php endforeach; ?>
` -
- Posted 3 years ago #
Okay, I've managed to figure some of it out, I'm using:
<br /> <pre><code><?php $posts = get_thread( $topic->topic_id, $page ); //pulls posts fo each topic?> <li <?php topic_class(); ?> style="border: 1px solid green;"> <?php foreach ($posts as $bb_post) : $del_class = post_del_class(); ?> <ul class="TopicStarterInfo"> <li><?php post_author_avatar(); ?></li> <li><?php post_author_link(); ?></li> <li><?php post_author_title(); ?> <li><?php printf( __('Posted %s ago'), bb_get_post_time() ); ?> </li> <li><?php echo $bb_post->forum_id;?></li> </ul> <?php endforeach; ?>But its pulling all the post authors. I think I need to limit to the first one, but I'm not exactly sure how to do that.
Edit: figured it out from: http://bbpress.org/forums/topic/separating-the-first-post-of-each-topic#post-21808
using:
<?php $bb_post = $posts[0]; unset($posts[0]); $del_class = post_del_class();?>instead of the foreach.
-
You must log in to post.