Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a customised forums front page for bbPress, by listing forums in a different way to the bbPress default.

Essentially what I'm trying to do is replace the use of bbp_list_forums() with a second, nested bbPress loop so that I have greater control over how the sub-forums are displayed.

I know I can use the 'before' and 'after' parameters of bbp_list_forums() but that doesn't give me as much control as I need.

The only question I found that came close was this one which doesn't actually provide a definitive answer.

My code so far is like so;

<?php while ( bbp_forums() ) : bbp_the_forum(); ?>

<li class="bbp-header">

    <ul class="forum-titles">
        <li class="bbp-forum-info"><?php bbp_forum_title(); ?></li>
        <li class="bbp-forum-freshness"><?php _e( 'Latest post', 'youngsibs' ); ?></li>
        <li class="bbp-forum-topic-count"><?php _e( 'Threads', 'youngsibs' ); ?></li>
        <li class="bbp-forum-reply-count"><?php bbp_show_lead_topic() ? _e( 'Replies', 'bbpress' ) : _e( 'Posts', 'bbpress' ); ?></li>
    </ul>

</li><!-- .bbp-header -->

<li class="bbp-body">

        <?php
            bbp_list_forums(array(
                'before' => '<ul id="bbp-forum-'.bbp_get_forum_id().'" '.bbp_get_forum_class().'>',
                'after' => '</ul>',
                'link_before' => '<li class="bbp-forum-info">',
                'link_after' => '</li>',
                'count_before' => '<li class="bbp-forum-topic-count">',
                'count_after' => '</li>',
                'count_sep' => '</li><li class="bbp-forum-reply-count">',
                'separator' => '</ul><ul id="bbp-forum-'.bbp_get_forum_id().'" '.bbp_get_forum_class().'>',
                'forum_id' => '',
                'show_topic_count' => true,
                'show_reply_count' => true
            ));
        ?>

</li><!-- .bbp-body -->

<li class="bbp-footer">

    <div class="tr">
        <p class="td colspan4">&nbsp;</p>
    </div><!-- .tr -->

</li><!-- .bbp-footer -->

<?php endwhile; ?>

See the bbp_list_forums() reference - in place of that I want another "while (bbp_forums())..." loop but how do I do that without interfering with the main loop?

share|improve this question
add comment

1 Answer

Had exactly the same problem. Found that great article by Scott Taylor and managed to mimic his functions to work for forums.

share|improve this answer
    
Lone link is considered a poor answer (see help > deleted answers) since it is meaningless by itself and target resource is not guaranteed to be alive in the future. Please try to include at least summary of information you are linking to. –  Rarst Feb 9 at 18:03
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.