Step by step guide to setting up a bbPress forum – part 3
Part 2 of the guide dealt with styling changes.
This part will deal with changing what appears and where it appears – changing some of the functionality of bbPress.
Now you can alter functionaility in many ways. These include
1. with plugins
2. with functions
3. by changing bbPress files
4. adding filters
5. adding hooks
1. Plugins
If you’re not familiar with coding, then plugins can offer a great way to add functionality without needing to do coding. There are lots around, if you’re after something it’s always worth trying a google search with “bbpress plugin” and whatever you are after.
Some I have used include :
bbP signature – lets users add a ‘signature’ to their posts – used a lot in forums
bbP topic views – displays how many times a topic has been viewed
and ones that might well be useful, but I haven’t used :
bbpress-notify – notifies admins, moderators etc. (fully configurable to role) when new post and replies are made
The rest of this part will assume that you have a child theme, if you’re not familiar with what this is and why you need it, please visit part 2 of this guide where it is all explained.
So lets assume you have a child theme.
2. Functions
This guide is not a primer on wordpress, and if you want to use functions to alter how bbPress works, then you’re probably already familiar with them. However if you want some guidance on functions visit
http://codex.wordpress.org/Functions_File_Explained
3. Changing bbPress files
This part of the guide is primarily going to deal with the bbPress templates that the default bbPress plugin uses to display your forum.
Changing these files gives you a powerful way to improve how your forum works for your users, and in some cases making it easier for you to administer.
In part 2 we explained how changing files in the bbPress plugin was not a good idea, and these files are frequently overwritten on an upgrade. So to change files, you’ll need to copy them you your child theme.
Bbpress will normally use the default files found at
wp-content/plugins/bbpress/templates/default/bbpress
However if you create a directory in your child theme at
/wp-content/themes/%your-theme%/bbpress/
(where %your-theme% is your child theme’s name)
then any files stored there will be used instead.
This means that if you want to alter how a topic displays, then copying the relevant file (in this case loop-single-reply) to this folder will mean that bbPress uses this file instead, so you can now alter it to work how you want.
There are two sources that you might want to use for files – one is at
wp-content/plugins/bbpress/templates/default/bbpress
For instance in this bbPress folder you’ll find
loop-single-reply - this file displays a topic and all its replies letting you change the heading and the format within a post – for instance removing the avatar or adding extra words below it.
If you want to alter lower level files, then the other source is
wp-content/plugins/bbpress/templates/default/extras
Here you can alter for instance whether a single topic has a footer.
To alter any of these lower level files they need to be copied to the root of your child theme that is to
/wp-content/themes/%your-theme%/
(where %your-theme% is yout themes name).
So bbPress offers a simple way to change the layout and information displayed.
As an example, the default forum display looks like
which displays the forum counts for the sub-topics.
If you wanted to take these out to look like
Then you would need to change
loop-single-forum.php
The line within this that displays the count is line 30 which has within it
bbp_list_forums()
To take out the topic list we need to disable topic and reply counts and take out the comma separator. To do this we would substitute the following code as described in http://codex.bbpress.org/bbp_list_forums/
bbp_list_forums(array (
'show_topic_count' => false,
'show_reply_count' => false,
'separator' => '',
));
So copy the file loop-single-forum.php from wp-content/plugins/bbpress/templates/default/bbpress to /wp-content/themes/%your-theme%/bbpress/
and edit line 30 to do the above change. Then save, and hey presto, the counts have gone !
[a list of what each bbPress template does would be good here or in a reference page - I don't have the knowledge so if anyone does (or can add any to a list), post a list in the 'requests & feedback' part of the forum, and I'll pick it up and add it]
For some starters on what you might want to change have a look at Layout and Functionality – Examples you can use