- This topic is empty.
July 4, 2015 at 11:20 am #204580
Hi there, I am trying to understand how Chris was able to create the “Or, browse all topics combined.” link at the bottom of the forums root on this website. As far as I can tell, this was custom. Anyone have any clue?July 5, 2015 at 3:58 am #204588
He most likely
- created a landing page called “all-topics” (child of forums page),
- created a custom template,
- query the database and get all forum posts
Hope that gets you going, if you have a specific question regarding setting up any of the previously mentioned steps let us know and I’m sure many will offer guidance. @timsilvaJuly 5, 2015 at 1:41 pm #204606
Thanks Alen! Looks like the missing piece of understanding on my side might be around custom template pages. I’ll learn more about that to see if I can achieve my goal that way. The challenge for me has been around creating a page URL that is under the bbPress directory.
Ideally, I want one of the following:
1.) domain.com/forum/ – with index of forums
2.) domain.com/forum/latest/ – with all topics sorted by freshness
Or, the opposite (which is preferred):
1.) domain.com/forum/ – with all topics sorted by freshness
2.) domain.com/forum/categories/ – with index of forums
(^the goal here is so that category URLs like “/forum/categories/news/” could have the category, “news” in this example, be removed without returning a 404 page.)
There are premade shortcodes to both list the index of forums [bbp-forum-index] and all topics by freshness [bbp-topic-index] onto a custom page. My issue, however, is that custom pages aren’t allowed to be given custom slugs/urls that include a slash. So when I try to create either one of those custom pages, and I set the url to “/forum/categories/”, for example, it saves the slug as “/forumcategories/” with the slash being automatically removed.
I haven’t tried using child pages yet since I expect there would be conflict issues of create a page with the same URL as the bbPress install just for the sake of creating a child page.July 5, 2015 at 3:22 pm #204607
I just tested this and it worked:
- Installed/Activated bbPress
- Created Page “forums”
- Created Child Page “all”
- Created Custom template and applied it to child page from step #3
- Created Custom WP_Query for post type of
forumsor use the [shortcodes]
The challenge for me has been around creating a page URL that is under the bbPress directory
I haven’t tried using child pages yet since I expect there would be conflict issues of create a page with the same URL as the bbPress install just for the sake of creating a child page.
If you look at the WordPress Template Hierarchy, Custom Post Type (in our case
forums) will take precedence over a page template. (step 2,3)
WordPress uses query string to load appropriate templates. So the page ‘forums’ we created will be blank, it’s just there so that whatever child page we create, well then the query string changes, so the proper template is returned.
re: Custom Template
This is nothing more than a php file, you can name it whatever you want, place it in your theme folder, the minimum requirement is, at the top of the file you have to define it as a template. So:
<?php /** * Template Name: Forum All View */ // rest of your template code
Or, the opposite (which is preferred)
Not exactly sure what you mean by second approach.July 5, 2015 at 3:33 pm #204609July 5, 2015 at 4:19 pm #204610
Thank you so much for the generous help & screenshots Alen! I’ll give this a shot :)
- The forum ‘Back End’ is closed to new topics and replies.