June 2026 promo! Join our Discord free of charge.

Slick­Stack
Lightning-fast WordPress on Nginx

how to force bbPress to use a page template or page loop contents

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #25437
    Thomas
    Guest

    This problem has been around a long time and still not many good solutions:

    Template hierarchy in detail

    Besides manually creating template files for every piece of bbPress, which most website owners are not able to do

    #25438
    Arthur
    Guest

    How do I get bbpress pages to use a specific page template in WordPress?

    Force bbPress to use different template then page.php

    You can try creating bbpress.php or just forum.php for just the forum index page, but then there is no content/loop loaded for the forum index

    #25439
    Doris
    Guest

    sounds like most users just want bbpress forums to use “no sidebar” page template, and they have a page called “Forum” but page-forum.php does not work and you can’t also change the page template inside the post editor window either, this is because bbPress does not consider that to be a page… it is archives.

    so you can also use archive-forum.php instead of forum.php

    #25440
    Ann
    Guest

    I tried it.

    forum.php did not work, but archive-forum.php did work

    ONLY for the forum index page.

    #25441
    Doris
    Guest

    bbpress documentation is really bad and outdated btw….

    #25442
    Susan
    Guest

    If you don’t want to create a fully custom template for the forum index (or topics etc) and just want to use the WordPress post editor to manage the forum index contents, I don’t think there is a solution because bbPress does not consider that to be a page. If you don’t have any bbPress template files, you can trick bbPress by create a page called /forum/ or /forums/ depending on your bbPress settings, and then edit the loop with the post editor. And because of WordPress loading order, it will load the page first, and show that to users, so it is kind of skipping the bbPress loading order which would otherwise hit index.php I believe.

    However you can’t choose the page template in this method. bbPress will force-load the layout of index.php or page.php regardless of your /forum/ page template settings. So ironically it will display the loop content, but ignore the chosen template.

    #25443
    Robert
    Guest

    Pretty much you would need to have a template like forum.php and then instead of having a normal loop like:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
        <?php the_content(); ?>
    <?php endwhile; endif; ?>

    you have to call the loop of the specific page you want to use, eg. /forum/ or whatever.

    $id=47;
    $post = get_page($id);
    $content = apply_filters('the_content', $post->post_content);
    echo $content;

    see https://wordpress.stackexchange.com/a/12168/152624

    #25450
    Frances
    Guest

    but still requires custom hardcode yeah?

    #25451
    Gloria
    Guest

    Okay folks:

    https://github.com/littlebizzy/hovercraft/blob/master/archive-forum.php

    HoverCraft has a solution for this now.

    Simply make sure you have a page with the slug “forum” a.k.a. /forum/ and the theme will automatically use the title and post content for the bbPress forum index. We might add the option later to choose the page you want to use in the Customizer, but for now it seems logical that most sites will use /forum/ for the bbPress index.

    #26298
    Evelyn
    Guest
Viewing 10 posts - 1 through 10 (of 10 total)
Reply To: how to force bbPress to use a page template or page loop contents

Thanks to our generous sponsors for their support!