Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End bbPress "Or, browse all topics combined." option?

  • This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #204580
    timsilva
    Participant

    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?

    #204588
    Alen
    Participant

    He most likely

    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. @timsilva

    #204606
    timsilva
    Participant

    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.

    #204607
    Alen
    Participant

    @timsilva

    I just tested this and it worked:

    1. Installed/Activated bbPress
    2. Created Page “forums” example.com/forums
    3. Created Child Page “all” example.com/forums/all
    4. Created Custom template and applied it to child page from step #3
    5. Created Custom WP_Query for post type of forums or use the [shortcodes]

    The challenge for me has been around creating a page URL that is under the bbPress directory

    and

    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.

    #204609
    Alen
    Participant
    #204610
    timsilva
    Participant

    Thank you so much for the generous help & screenshots Alen! I’ll give this a shot :)

Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘Back End’ is closed to new topics and replies.