Displaying topics on the front page
-
….I really tried to look for documentation and plugins for this, but no luck. could you guys help me out with some code to do this?
PROBLEM: I want to show the forums with the 4 most recent topics in each on the front page
like this….
forum 1
– forum 1 topic 1 — willie — jan 12th
– forum 1 topic 2 — bob — jan 4th
– forum 1 topic 3 — sue — jan 2nd
– forum 1 topic 4 — matt — jan 1st
forum 2
– forum 2 topic 1 — paul — feb 10th
– forum 2 topic 2 — mike — feb 9th
– forum 2 topic 3 — rob — jan 20th
– forum 2 topic 4 — hank — jan 5th
NOT SOLUTION: i tried writing this code, but it shows the most recent topics over all
<?php if ( bb_forums() ) : ?>
<!-- <h2><?php _e('Forums'); ?></h2> //-->
<table id="forumlist">
<?php while ( bb_forum() ) : ?>
<tr class="titletext titlebar">
<td><?php bb_forum_pad( '<div class="nest">' ); ?><a>"><?php forum_name(); ?></a><?php forum_description( array( 'before' => '<small> – ', 'after' => '</small>' ) ); ?><?php bb_forum_pad( '</div>' ); ?></td>
<td class="num"><?php forum_topics(); ?></td>
<td class="num"><?php forum_posts(); ?></td>
</tr>
<?php if ( $topics ) : ?>
<tr>
<td colspan="3">
<table class="small">
<?php
$i = 0;
foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><?php bb_topic_labels(); ?> <a>"><?php topic_title(); ?></a><?php topic_page_links(); ?></td>
<td class="num"><?php topic_posts(); ?></td>
<!-- <td class="num"><?php bb_topic_voices(); ?></td> -->
<td class="num"><?php topic_last_poster(); ?></td>
<td class="num"><a>"><?php topic_time(); ?></a></td>
</tr>
<?php
$i++;
if($i>4) break;
endforeach;?>
</table>
<?php endif; ?>
<?php endwhile; ?>it displays….
forum 1
– forum 1 topic 1 — willie — jan 12th
– forum 1 topic 2 — bob — jan 4th
– forum 1 topic 3 — sue — jan 2nd
– forum 1 topic 4 — matt — jan 1st
forum 2
– forum 1 topic 1 — willie — jan 12th
– forum 1 topic 2 — bob — jan 4th
– forum 1 topic 3 — sue — jan 2nd
– forum 1 topic 4 — matt — jan 1st
Thank you in advance for any help. Even pointing me to template tags reference point!
- You must be logged in to reply to this topic.