Skip to:
Content
Pages
Categories
Search
Top
Bottom

How to use bbPress’ fuctions to loop through forums in a WordPress theme


  • fuzzybee
    Participant

    @fuzzybee

    I’m trying to create a custom forum index page which should look exactly like the default forum index page with forum names, number of topics, number of posts, last active topic etc. but sorted alphabetically based on forum names.

    I’m looking at at bbp_has_forums, bbp_forums and bbp_list_forums inside /wp-content/plugins/bbpress/bbp-includes/bbp-forum-template.php.

    However, I’m puzzled which function to use and
    What arguments/ parameters I should pass?
    the comments in bbp-forum-template.php itself says the same parameters as WP_Query() but would it make sense at all to have something like “post_type” => “forum”
    I’m sure one can be clearer/ more explicit about the parameters here in some form of documentation

    I gave it wild tries as follows
    1) The following gives me fatal error:

    $args = array(

    'orderby' => 'title',
    'order' => 'ASC',

    );

    while (bbp_forums($args)){
    bbp_the_forum();

    echo bbp_get_template_part( 'content', 'archive-forum' );

    }

    The error:
    Fatal error: Call to undefined method stdClass::have_posts() in C:\www\forums.local\wp-content\plugins\bbpress\bbp-includes\bbp-forum-template.php on line 109 Call Stack: 0.0004 333592 1. {main}() C:\www\forums.local\index.php:0 0.0006 337280 2. require(‘C:\www\forums.local\wp-blog-header.php’) C:\www\forums.local\index.php:17 0.3864 38499368 3. require_once(‘C:\www\forums.local\wp-includes\template-loader.php’) C:\www\forums.local\wp-blog-header.php:16 0.3920 38515824 4. include(‘C:\www\forums.local\wp-content\themes\bp-tap\custom-index.php’) C:\www\forums.local\wp-includes\template-loader.php:43 0.4732 38674368 5. bbp_forums() C:\www\forums.local\wp-content\themes\bp-tap\custom-index.php:42

    2) While the following just takes forever to load:

    $args = array(

    'orderby' => 'title',
    'order' => 'ASC',

    );

    while (bbp_has_forums($args)){
    bbp_the_forum();

    echo bbp_get_template_part( 'content', 'archive-forum' );

    }

    I’m using WordPress 3.4.2 and bbPress 2.1.2.
    I’ve copied all files and directories from /wp-content/plugins/bbPress/bbp-themes/bbp-twentyten/ to my theme directory.

    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
    • This topic was modified 11 years, 11 months ago by fuzzybee.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.
Skip to toolbar