Integrating the Various Presses

20th December 2009    

My latest client project was to use WordPress, and needed a forum to match. I’ve used phpBB and WordPress together previously but it did leave something to be desired, so I set off in search of something a bit more integrated.

Soon I stumbled upon bbPress, the forum by Automattic (the WordPress guys) and the same one used for the WP support forums. This was definitely going to be easy.

Hurdle 1

I wasn’t just integrating with any old WordPress theme, I was working with a premium theme from Woothemes that made everything just that little bit more complicated.

Hurdle 2

The documentation for WordPress is so amazing I didn’t for one second stop to consider the fact that it may be lacking for bbPress. I did find all the information I needed, but it took a fair bit of Googling.

The Basics

There are different levels of integration between these two platforms, and I wanted the whole thing. First off, though, I had to get to grips with the installation.

While it is very easy and well explained, it does take a bit longer than the usual WordPress install due to the fact that you need to give bbpress some cookie and database settings if you want to share logins between the two. This is very simple, as helpful links next to each form field during install give you clear directions. No worries so far.

Once installed, I needed to map the user roles. For example, I am now a proud admin in WordPress and Key Master in bbPress.

All of the above is explained beautifully in the docs.

Now, at first I thought I was going to need to build a theme that looked exactly like my main site theme. Thankfully this wasn’t the case.

In bbPress template files, the <?php get_header; ?> we all know and love is replaced by <?php bb_get_header; ?>. That’s no good, we want to be able to link to the main site in our page and so on without hardcoding it in! Thankfully there is a very straightforward way.

In bb_config.php, add this line at the start:


wp_blog_header.php is located in your WordPress root folder, and you must use the actual filepath (not a relative path or URL).  Including this file makes all those lovely WordPress functions available for use by bbPress. Excellent.

If you, like me, are copying a default forum theme you’ll need to find each instance of <?php bb_get_header; ?> and <?php bb_get_footer; ?> and replace them with <?php get_header; ?> and <?php get_footer; ?> respectively. Now your forum should be using at least some semblance of your main theme.

Chances are you don’t already have the forum-specific CSS in your WordPress theme, so here you have two choices. Adding everything you need to your WP theme’s style.css will include it in the forum, but unfortunately will also include it in every page of your main site. I chose to check whether or not the current page was bbPress, and if so load a seperate stylesheet with <?php bb_stylesheet_uri(); ?>. I used a simple isset to check for the $bb variable, indicating this was a forum page.

The Advanceds

Using a non-standard theme threw up it’s share of complications. The theme in question had a style.css, but also various other css files depending which colour scheme was chosen and a further custom.css file to keep things seperate and make upgrading easier. The problem was that style.css was included in the theme’s header.php, but the others were sent to wp_head by a theme function and were not making it onto the forum pages. If you find you have a similar situation, the solution was to find the relevant function file and remove those two links, adding them manually into header.php. It feels wrong to fiddle with clever code, but alas.

I had a similar problem with wp-cufon, which was installed on my main site making the navigation links beautiful. Because the script was called with wp_head it didn’t make it to the forum, and more manual coding was needed. My kingdom for a bb-cufon plugin!

In the end, everything seems to work. This was my first time playing with bbPress and no doubt I’ve done several idiotic things (like making half a new theme before reading that I could include that wp_blog_header.php *ahem*) but the result is a good one. Now I feel the itch to learn something new, but it’s 3:34 am and I shall be a good girl. Night all!

Categories: Tutorials


Leave a Reply

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

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match