PHP code for this shortcode
-
What’s the PHP code to get this result.
[bbp-single-forum id=$forum_id] – Display a single forums topics. eg. [bbp-single-forum id=32]
I would like to include it inside a page template.
Something I really HATE about bbPress is that it’s very easy to group a bunch of forums inside another forum ( Category ) and list all those forums together at a page template by just the Parent $forum_id of all those forums and you’re done.
Just like this:<?php if ( bbp_has_forums( array( 'post_parent' => 104 ) ) ) : ?>
Easy right, but that bbp_has_form functions doesn’t have something like this:
<?php if ( bbp_has_forums( array( 'forum_id' => 75 ) ) ) : ?>
Only show forum_id 75 out of the entire loop, or this:
<?php if ( bbp_has_forums( array( 'forum_id' => 75,88,93 ) ) ) : ?>
That doesn’t look like rocket science to me and it would give us so much more customization options.
Look at this screenshot I made.
At the top the block of 4 with the big headings, Mac … + iOS … are forum categories with a bunch a forums inside them. I gave them all their own page templates with each its own ‘post_parent’ Loop.<?php bbp_get_template_part( 'cat-forums/mac-hardware' ); ?>
At the bottom the green row of none Apple products related are just forums ( single’s ) with no parent stuff.
It’s ridicules difficult to group them together and list them in a list or row and customize them.
You have to do something like this:<?php bbp_forum_permalink( 98 ); ?> <?php bbp_forum_title( 98 ); ?> <?php bbp_forum_topic_count( 98 ); ?> <?php bbp_forum_post_count( 98 ); ?>
That’s all needed to get the same result as at the top for just a single forum_id.
Beside all that frustration it’s even more difficult to give each single forum ( the page where you show a list of topics ) it’s own template.
You can’t customize the forums differently. Let’s say I want to give al forums at the top the Apple products relegated stuff it’s own page template and all none Apple related stuff another page template it’s simply not possible.There should be an easy way to just add a forum_id or name after the page-template.php like WordPress does.
Maybe for starters a conditional tag inside the content-single-forum.php template that says, if forum_id’s 75,98,114 go to template X and if forum_id’s 73,120,88 go to template Z else ( if none of those ID’s ) go to template B.This has been frustrated me for 2 years now and it’s really a game-breaker in customization of bbPress.
🙁
- You must be logged in to reply to this topic.