Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Hiding Subforums’ Subforums from Subforum Pages


_ck_
Participant

@_ck_

The way I hide sub-forums on the front-page is to wrap the code that lists the forums in this simple code:

<?php if (!$forum->forum_parent) { ?> <– this

<tr<?php bb_forum_class(); ?>>

blah blah

</tr>

<?php } ?> <– and this

It essentially just checks if the forum has a parent and doesn’t show it. Now on the forum page that’s a problem because any forum listed would have a parent. Gotta think about that one for a minute…

Oh wait, I know what to do, we just have to check if the forum_parent is equal to the current forum id. This is untested but in theory should work:

<?php $forum_parent=$forum_id; ?>
<?php while ( bb_forum() ) : ?>
<?php if ($GLOBALS['forum']->forum_parent==$forum_parent) { ?>
<tr<?php bb_forum_class(); ?>>
<td><?php bb_forum_pad( '<div class="nest">' ); ?><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a><small><?php forum_description(); ?></small><?php bb_forum_pad( '</div>' ); ?></td>
<td class="num"><?php forum_topics(); ?></td>
<td class="num"><?php forum_posts(); ?></td>
</tr>
<?php } ?>
<?php endwhile; ?>

Skip to toolbar