Skip to:
Content

bbPress.org

Opened 3 years ago

Closed 2 months ago

Last modified 2 months ago

#3487 closed defect (bug) (fixed)

bbPress block theme support

Reported by: mikachan's profile mikachan Owned by: johnjamesjacoby's profile johnjamesjacoby
Milestone: 2.7 Priority: high
Severity: major Version: 2.6.9
Component: Appearance - Theme Compatibility Keywords: has-patch needs-unit-tests
Cc:

Description

bbPress doesn't seem to currently support block themes. When testing with Twenty Twenty-Three and Twenty Twenty-Two, bbPress pages render a WSOD.

I believe it's related to the index.php file that's included with the theme, as it looks like it's possible to (sort of) fix some of the pages by including the following in this file:

wp_head();
block_header_area();
block_template_part( 'page-inner' );
wp_footer();
block_footer_area();

There is a related discussion in the support forums: https://bbpress.org/forums/topic/template-in-block-themes/

There is also a similar ticket for the BuddyPress plugin, which seemed to be related to the index.php file as well. I'm not sure if it helps as I can't find any similar logic in bbPress, but here's the ticket: https://buddypress.trac.wordpress.org/ticket/8474#comment:31

(Apologies if this has already been reported, I couldn't find a related issue.)

Change History (13)

#1 @Robin W
3 years ago

add_filter( 'template_include', 'bsp_twenty_twentytwo') ;

function bsp_twenty_twentytwo ( $template ) {

if ( false !== strpos($template, 'twentytwentytwo/index.php') ) {

$template = ABSPATH . WPINC . '/template-canvas.php';

}
return $template;

}

This ticket was mentioned in PR #7 on bbpress/bbPress by @mikachan.


3 years ago
#2

  • Keywords has-patch added

This PR tries out adding support for block themes.

It checks if the current theme supports block-templates, and if so, uses the template-canvas.php as the main template.

This solution is based on this comment.

To test, try enabling bbPress with the Twenty Twenty-Two or Twenty Twenty-Three themes. Without this PR, the forum pages will not render. With this PR, they should render correctly.

Trac ticket: https://bbpress.trac.wordpress.org/ticket/3487

#3 @mikachan
3 years ago

Thanks, @robin-w! I've tried this out in the plugin with the above patch.

#4 @mikachan
3 years ago

  • Keywords needs-testing added
  • Severity changed from normal to major

#5 @arafatjamil01
3 years ago

I have checked your pull request on Github and tested the code. The code worked perfectly. Please add an extra * at the beginning of the comment.

That is

/**

Instead of

/*

Just to maintain consistency with the other comments.

#6 @Robin W
3 years ago

@arafatjamil01 thanks, I'm working on a new bbpress.php template that will work properly with FSE themes.

I plan to release this within my bbp-style-pack plugin in a week or so

@mikachan commented on PR #7:


3 years ago
#7

Thanks for the review, @arafatjamil01!

I've fixed up the comment formatting so it's consistent with the other comments in the file.

#8 @johnjamesjacoby
2 months ago

  • Keywords needs-unit-tests added; needs-testing removed
  • Milestone changed from Awaiting Review to 2.7
  • Owner set to johnjamesjacoby
  • Priority changed from normal to high
  • Status changed from new to assigned

@johnjamesjacoby commented on PR #7:


2 months ago
#9

Thanks for the PR!

Even though BuddyPress did something similar, this needs a deeper dive. I've assigned the Trac ticket to myself and moved it into the 2.7 milestone.

#10 @Robin W
2 months ago

might be worth a look at this, as it seems to work well

https://wordpress.org/plugins/enable-bbp-block-theme/

#11 @johnjamesjacoby
2 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7394:

Core - Theme Compat: add Block Theme support.

This commit includes the following changes:

  • Deprecates bbp_get_theme_compat_templates() for a singular version
  • Introduces bbp_get_theme_canvas_template() to retrieve a filtered path to theme-canvas.php
  • Introduces bbp_get_template_include_templates() to retrieve a filtered array of checker & getter functions
  • Simplifies bbp_template_include_theme_supports() into a foreach loop
  • Simplifies bbp_is_template_included() usage inside of bbp_template_include_theme_compat() by removing the later check now that 404's are handled elsewhere

Props mikachan, robin-w, arafatjamil01, johnjamesjacoby.

Fixes #3487.

In trunk, for 2.7.

#13 @Robin W
2 months ago

Tested and seems to be working fine :-)

Note: See TracTickets for help on using tickets.