There are many ways to modify the way the bbPress forums look like, styling changes, filters and actions and overriding the templates bbPress uses to render all the forums elements.

bbPress can work with any theme using something called ‘theme compatibility’ layer. It allows bbPress to use common ‘page.php’ template and embed inside the rendered content for forums. But, the default layout of the forum might not fit with every theme, and that is why bbPress can be completely changed by overriding and changing default templates that come with bbPress. And, that is something some theme use to modify the way bbPress looks and feels. Most theme don’t change the templates, but only styling. Still, some things can’t be changed without making modifications to templates.

Example of the bbPress Template content
Example of the bbPress Template content

Methods for the modifications

There are 3 ways to modify the look and feel of the bbPress forums.

  1. CSS styling: this is most common method to customize bbPress forums. It doesn’t affect the layout and the templates, only the styling is affected, allowing themes to adjust the forums to look more like the theme. Most themes with bbPress support are using this customization method.
  2. Filters and Actions: third party plugin developers can use actions and filters present through out bbPress and bbPress templates to control various aspects of the forums, add extra elements into forums and more. All plugins made for bbPress are using this customization method.
  3. Templates override: this method is used by some themes to change the layout of the forums by directly modifying the templates bbPress use to display forums, topics, replies and other elements. In theory, other plugins can do this, not just themes, because bbPress allows adding extra template storage locations (but, that is not in the scope of this tutorial).

bbPress Templates

bbPress templates are similar to theme templates, they are used to display all forums elements. These templates are combination of HTML and PHP, and they include a lot of filters and actions that can help plugin developers hooking into different template parts. For a lot of changes, using filters and actions is quite enough to make complex changes, and the only method that can do everything, is the modification of templates.

All default templates bbPress uses are located inside the bbPress plugin directory under ‘templates/default/bbpress’. There are 50+ templates there, and they use easy to follow naming scheme to help you find the template you need. But, good practice is to follow each template and make note when the template uses ‘bbp_get_template_part‘ functions to load different template parts.

Templates Override

To override the template in your theme, you should follow these simple rules:

  1. Make sure that your theme has a ‘bbpress‘ directory. All templates you override should go into this directory.
  2. Find the bbPress template you want to change in the bbPress plugin directory ‘templates/default/bbpress‘.
  3. Copy the template from bbPress directory into your theme ‘bbpress‘ directory.

Repeat steps 2 and 3 for all templates you need to change.

For instance, you want to make changes to the ‘form-topic.php‘ file. Default file is located in this directory: wp-content/plugins/bbpress/templates/default/bbpress/ and you need to copy it into your theme bbPress directory: wp-content/themes/theme-name/bbpress/.

Important Notices

When you make changes to bbPress templates, you should note the following:

  1. New bbPress versions often make changes to default templates. So, if your theme overrides a template from older version of the bbPress, when new bbPress is released, your override template might be lacking some new features added in latest version. When new bbPress is released, make sure you check the templates you override in your theme and adjust them for the new templates in bbPress.
  2. Do not remove any actions and filters from the templates you are changing (do_action and apply_filters function calls)! If you remove any of them, you are risking breaking some of the features in bbPress or features added by the third party plugins.
Please, take a few seconds and rate this post
Rating: 5.0/5. From 3 votes. Votes Distribution.
Please wait...

About the author

Milan Petrovic

Programmer since the age of 12 and now WordPress developer with more than 8 years of WordPress experience, author of more than 100 plugins and more than 20 themes.

GD bbPress Toolbox Pro - Enhancing WordPress forums powered by bbPress

The Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Namecheap - Your dream domain awaits