It seems to be insanely difficult to find out how to hide subforums or child forums from the main forum page in BBPress, even though it seems like such a simple and obvious thing to want to do. As it turns out, how to hide subforums is simple, it’s just not obvious.
First, to show you what we mean, here’s a live example.
The website at DadsRights.org recently launched a set of fathers rights forums. One section of their forums is the state-by-state listings, meaning that they have 50 subforums in that section (one for each state). Out of the box, this is how the forums home page looks with this set of subforums:
Pretty cluttered, right? You can see why they may have wanted to tidy that up a bit.
|Pssst! Get notified of new TIP articles here:|
In fact, what DadsRights.org wanted was to make it look like this:
Now, doesn’t that look better?
And, when someone clicks on the “State by State Information” forum, what they see is:
Now, how to do this?
As you may have discovered, if you searched Google or other Internet search sites for this information, there isn’t much out there, and what is out there tells you that you need to change and fiddle with the line <?php if (bb_forums()); ? >.
But it’s actually much simpler than that. At least it is for some WordPress / BBPress installs – we can’t promise that this easy fix will work for all combinations of WordPress, BBPress, and various themes.
Instead of editing the line <?php if (bb_forums());? >, do this:
Go to your /plugins/bbpress directory.
Now go to the /templates/default/bbpress/ subdirectory.
There you will see the loop-single-forum.php file.
Make a backup of the loop-single-forum.php file!
Really, make the backup! Don’t say that we didn’t warn you!
Now, edit the loop-single-forum.php file, and find the line with <?php bbp_list_forums(); ?>.
We found it on line number 44:
Now, simply delete that line, save the file, and you’ll find that the subforum list is completely gone from your forum home page, with the added advantage that when you click on the forum to get to the subforums, the list of subforums is nice and neat!
(Hey! Please let us know if you liked this article by leaving us a comment!)
You might also like some of our other articles: