How do I use the [bbp-single-forum id=$forum_id] shortcode in a template file?
I’m trying to make my forums’ home page display what you get when you put [bbp-single-forum id=$forum_id] in a page. I am editing “archive-forum.php” to do so, since the result will be a more fleshed out version of archive-forum.php anyway.
“Echo do_shortcode” doesn’t seem to work in the .php file, and I’ve been screwing around with this and trying out different strings of PHP code for about six hours straight.
In reality, I will be showing two different categories with the [bbp-single-forum-id=$forum_id] code, each with several forums in them. I’ll have to add some extra divs for the names of the categories, but I can do that myself.
Whatever happens, I don’t care if I use a shortcode or if I use PHP; but if POSSIBLE, I’d rather not add anything to my functions.php. But I’ll do what I must.
Thanks in advance.
It’s been 24 hours, and I can’t do anything with my site until I figure this out. So… “bump”.
You figuring it out doesn’t usually involve others handing you an answer.
I think you might be over-thinking things. Rather than trying to overload the WordPress template loader with a new archive-forum.php and trying to run something through a shortcode, why not just use a WordPress page, set the slug to /forums, and put the shortcodes and div’s in there instead?
I found the bug. You cannot make the “Forums” page that you put shortcodes into a parentless page. If the page is http://www.mysite.com/forums , then going to that URL will only take you to the archive page. Actually, it seems there I might be able to edit that in the settings page. I just had no idea that THAT was what that setting meant. I’m going to go take a look.
I’ve been using bbPress for about a year, and I just NOW discovered what was wrong with my permalinks. I think maybe the “archives” part of the settings page should be set to the word “archives”, not “forums” by default, so people don’t have trouble with this.
Anyway, I’m gonna go mess with that setting and see what happens. I will post my results here for future people to see…
That was the problem. You see, under the Settings page for bbPress, there is the Archive Slugs section. Under this is two settings: “Forums base” and “Topics base”. Due to the wording, I never knew that having the “Forums base” setting at its default, which is “forums”, I would never be able to use my WordPress-made custom forums page at http://www.mysite.com/forums , always getting the archives page instead of what I put in shortcodes on my custom page.
Maybe the labels for those settings should be clarified, and the default setting changed. I see lots of people having trouble with this part, and I’ve been using bbPress for a year and just discovered the answer.
Thanks for replying. I appreciate it. If I knew some PHP, and my site was done and I could spare some time, I’d help you with bbPress a bit. I know it must suck not having very many people helping out…
Yeah; the way WordPress handles archives automatically for us makes it a bit strange to figure out at first. Once you get it, it makes perfect sense though.
Any suggestions on how to better label the fields that would have made it easier to understand?
I can’t think of much, except for adding a warning stating that if the Forums base is “forums”, then the forums archive is going to override the page http://www.mysite.com/forums if the person chooses to make a forums page at that location.
On the opposite end, it should be noted that IF they want to put a forums page in that location, then they can’t use “forums” as their archive base.
Sometimes there is a warning that certain pages conflict with each other or with pages in the WordPress installation. I think that if both a WordPress page/post and a forums base/slug are the same “word”, that the error should say more than just “possible conflict”. I think it should say that the slugs or bases will override your WordPress page or post, and explicitly state that those pages or posts won’t show the WordPress page or post content as intended.
Helpful and informative warning messages are indispensable. Vague ones aren’t understood and are soon ignored…
The problem I had before is still here, and so I still need to change what the Archive Page shows. Changing the settings as said above worked at first, but now bbPress reverted back to showing the forum Archives on http://mysite.net/forums/ instead of what I put on my WordPress page at that location.
In my site’s main menu, I have a link called “Forums” that leads to “http://mysite.net/community/forums/”. This page is the custom page I made, to show the forum_id’s of my two forum categories, rather than showing the forum Archives.
My WordPress theme has a breadcrumbs system, as does bbPress. On the page that I created, WordPress says my breadcrumb path is:
Home » Community » Forums
While bbPress says it’s:
Home › Forums › Community › Forums
bbPress has this annoying thing about insisting that if you are inside the forums, it will add extra “sub-menus”, or path items, or whatever you call them, to your breadcrumbs.
In the bbPress settings page, I set my “Archive Slugs > Forums base” to “archives”, rather than the default “forums”. For “Single Slugs > Forum prefix”, I unchecked the box “Prefix your forum area with the Forum Base slug (Recommended)”.
bbPress seems to hate playing nicely with your site’s permalinks and breadcrumbs. I’ve always had this problem, ever since I started using bbPress.
I would be more than happy to hack up bbPress a bit so that I can fix the breadcrumbs and permalinks myself. I consider this a very persistent issue, as I see many people to this day wondering how on earth to get their forums to display at the proper location.
If there’s anything I can do to help get this problem fixed more permanently, I’d be more than happy to help.
After screwing around with various options for permalinks and for the location and links for my forums, I have decided, once again, that it is best to hack up the archive-forum.php. In fact, I think this very page should be completely changed to allow you to choose whether you want to display the forums archive there, or if you want to use the wordPress page editor to display shortcodes or whatnot. This should be an option in the bbPress settings.
This would solve pretty much everyone’s problems with permalinks and breadcrumbs, and I think it would be easy to do.
It has been 24 hours again. This is a very important problem with the bbPress system. Bump.
I’m being patient. I’ll take as long as I need. My site isn’t going anywhere. I think it should be considered a compliment to bbPress– bbPress is good enough for me not to give up on. And I’ve tried many forums systems.
What version of bbPress are you using? I think this issue is already fixed in 2.1 beta 1.
Also, thanks for the kind words.
2.0.3. bbPress 2.1 will be out soon? Do you have a changelog I can look over? I’m excited to see it.
Also, I’m putting my site on hiatus. I’m tired of it for a while. But you know what I would like to do? I’d like to help with bbPress. I think the total integration with WordPress that bbPress has is one of the best things ever accomplished for the blogging platform. I would love to assist, do some testing, give some of my thoughts, help promote bbPress, and even help with some new features that I have been hoping or wishing I could see in bbPress’s future.
I don’t know how much help you guys get, but it doesn’t seem like a lot. I wouldn’t ever want to see bbPress die. I want to help, if I may. I know very little about PHP or HTML, but every coder should have a team, to help with the things that coders aren’t best at. I want to help!
Best changelog I have is in our trac. It outlines every ticket and code change since 2.0 was released.
Thanks for your offer to help. What do you want to do? You can basically write your own ticket. If you’re familiar with IRC, you can join #bbpress on freenode; many of us idle there together to chat about what we’re working on.
This problem isn’t solved. I’m using bbPress 2.1.2 now, and I can’t, for the LIFE of me, find any way to make it so that “content-archive-forum” looks like “content-single-forum”. Or make it so that the breadcrumbs root, “forums”, just goes to a page of my choosing, ignoring “content-archive-forum” altogether. I wish content-archive-forum just looked like content-single-forum to begin with. That would solve ALL my problems!
This is getting real old. It is, and has always been, the one thing ruining bbPress for me…
- You stated my exact problem which I am currently having. I am a noob. But I can usually google search my way out of any problem. (Which led me here, but with no answer) I see that the “forums base” archive slug field is used in the breadcrumb for bbPress. When I click on the link in the breadcrumb, it takes me to the archive page….not what I want my users to be able to do at all. I want them to be able to get back to a forum index from anywhere inside bbPress.
I setup a WP page and used the bbPress shortcodes to give me a Forum index; which is the main portal to all of the topics and posts on my site.
However, once a forum/topic is selected by a user, the bbPress *.php takes over and the pages are dynamically generated ( i guess ). How do I send people back to the forum index WP page from anywhere inside bbPress? I would prefer the breadcrumb worked or at least could be redirected to the WP page. Linking me to an archive page does NOTHING for any user, when trying to get back to an index.
Hope that was descriptive enough to workout a solution. Thank you.
http://www.sailhavasu.com/event-forum/ <- WP Page with bbPress short codes creating a forum "index"
http:www.//sailhavasu.com/bbpress/forum/hpcc-2013/ <- bbPress page where the breadcrumb "Forums" links to an archive page. Would rather it linked to an index; either a WP page or a dynamically created bbPress page with an actual index. (Note: "bbpress" is what I named the Forums base Archive Slug; another issue that appears weird to a noob.)
I’m having the exact same problem. And like ffalder I can’t code, but usually Google my way out of a problem. But this time no luck.
From my research it seems lots of people are having the same problem.
I think the main issue here is the breadcrumbs.
1) You create a custom ‘forum home page’ using short codes (or whatever means you like) to be your default page that users see as the homepage of your forum.
2) A user try’s to get back to the ‘forum home page’ using the breadcrumbs by clicking the text “forums” in the breadcrumbs.
3) Unfortunately it just redirects to the forum slug chosen in Settings, not your actual ‘forum home page’. And that forum slug is always defaulted to an archives page.
4) So setting that slug to the same as your ‘forum home page’ does not work, because woprdpress overrides your ‘forum home page’ created in step 1 and defaults it to an archives page.
Sorry for re-hashing this, but it’s sometimes better to make it a little clearer. At least in my own head anyway.
I don’t know how simple this is or not, but one solution that comes to mind is to have an option in Settings that lets you decide where the ‘forums’ text link in the breadcrumbs will point to. If you can choose to have it point to your ‘forum home page’ then all would be solved right?
This person suggested changing the breadcrumbs in the core of the plugin, but obviously it’s not very desirable since it’s changes to the core. And I also cannot find the file that they edited. Think it might have been a mod to an old version: http://mysitemyway.com/support/topic/infocus-bbpress-20-root-slug
I re up this topic because the problem still here.
If someone get a solution without modify the core ?
Thx a lot
Hi, I’m also having the exact same problem and I’m wondering why this hasn’t been addressed yet? It wouldn’t have been an issue for me but BuddyPress now insists that you use bbpress for the forums.
PLEASE help someone!
antonyc resolved this issue by updating a theme’s forum template pages (archive-forum.php and forum.php) with a theme update per http://buddypress.org/support/topic/forum-root-returns-my-wp-archive-page/ FYI
Dear MTPrower (@mtprower),
Do you have resolve this issue? I am also surviving with same issue. I want to show certain list of forum in separate loop. Kindly help me.
My link is http://sainfoinc.net/zroor/forums
I created two Recent Forum (Help & Announcements)
i want to show them in different loop by using same design format.
If i succeed to show certain two forum separately, then how can i restrict to show them in main default forum list.
You must be logged in to reply to this topic.