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

closed as off-topic by Johannes Pille, Mark Kaplun, Pieter Goosen, birgire, s_ha_dum Oct 6 at 17:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Johannes Pille, Mark Kaplun, Pieter Goosen, birgire, s_ha_dum
If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

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

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