Skip to:
Content
Pages
Categories
Search
Top
Bottom

Getting Started in Modifying the Main bbPress Template

Codex HomeTheme Compatibility → Getting Started in Modifying the Main bbPress Template

[NOTE: The target audience for this page is someone who has basic familiarity with editing wordpress theme templates.]

If you are just picking up bbPress and you install it and want to make some basic changes to the template that is being rendered, it can be a little difficult to find documentation on where to begin. I don’t know if how I did it is the best way, but I dug around in the bbPress plugin code and discovered the following.

On a plain vanilla install of bbPress using a “normal” wordpress theme, the plugin looks for the following templates from the active wordpress theme and “injects” the forum into (i guess) the first one it finds:

'plugin-bbpress.php',
'bbpress.php',
'forums.php',
'forum.php',
'generic.php',
'page.php'

For most wordpress themes that means that it is going to inject the forum code into page.php.

If you want to create a custom template container for the bbPress forum — different from the rest of your wordpress site, you can copy the contents of page.php into a new file called (say) forums.php (which is not usually part of a generic wordpress theme — or you can use any of the other filenames in the list above). Then modify that new file at will and the bbPress plugin should pick up that template and render the forum in that context.

Another way that I discovered to render custom template code for the bbPress forum is to use the php function is_bbpress() inside a php if statement to do something like (sorry this thing won’t let me put in full php tags so this is pseudo-code):


if (is_bbpress()) :
div class="abc"
else :
div class="xyz"
endif;

For those who are knowledgeable about the innards of the bbPress architecture, I implore you to correct any mistakes I have made here and expand on this effort to provide some basic, getting started documentation so new adopters of bbPress can hit the ground running instead of spending a couple days (I did) getting to this point.