Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbp_list_forums

Codex Home → bbp_list_forums

The bbp_list_forums function is commonly used to display a list of sub forums. You can customise the returned data by passing the function some arguments.
The bbp_list_forums is a function located in \includes\forums\template.php.

To filter this array use:
add_filter( 'bbp_before_list_forums_parse_args', 'your_filter_name' );

An example list of arguments

array (
		'before'              => '<ul class="bbp-forums-list">',
		'after'               => '</ul>',
		'link_before'         => '<li class="bbp-forum">',
		'link_after'          => '</li>',
		'count_before'        => ' (',
		'count_after'         => ')',
		'count_sep'           => ', ',
		'separator'           => ', ',
		'forum_id'            => '',
		'show_topic_count'    => true,
		'show_reply_count'    => true,
		)

before
The value you specify for ‘before’ will be put at the start of the returned data.

after
The value you specify for ‘after’ will be put at the end of the returned data.

link_before
The value you specify for ‘link_before’ will appear before each row returned in the data.

link_after
The value you specify for ‘link_after’ will appear after each row returned in the data.

count_before
If you have show_topic_count or show_reply_count set to true, then this will attach itself to the start of each count.

count_after
If you have show_topic_count or show_reply_count set to true, then this will attach itself to the end of each count.

count_sep
The value specified inside count_sep is what separates each count, for example if you specified a comma the returned count would be: 0,0

separator
The value specified inside separator is what separates each subforum, for example if you specified <br /> the returned subforums would be displayed one per line.

forum_id
If you specify a forum_id then only child forums of the forum_id will be returned.

show_topic_count
This is a boolean flag, set it to true or false depending on if you want topic counts to be returned.

show_reply_count
This is a boolean flag, set it to true or false depending on if you want reply counts to be returned.

Common Code Examples

bbp_list_forums(array (
		'before' => '<tr>',
		'after' => '</tr>',
		'link_before' => '<td>',
		'link_after' => '</td>',
		'separator' => '',
));

Returns a list of forums without the comma between reply and topic counts.

bbp_list_forums(array (
		'before' => '<tr>',
		'after' => '</tr>',
		'link_before' => '<td>',
		'link_after' => '</td>',
		'separator' => '',
		'count_before' => '',
		'count_after' => '',
));

Returns a list of forums without the comma between and the brackets around the reply and topic counts.

Skip to toolbar