Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/01/2024 10:56:10 AM (11 months ago)
Author:
imath
Message:

Initialize the support of BP block only Themes

We are now using the locate_block_template() function to get block templates of BuddyPress content when active theme is supporting buddypress and is only using blocks.

For an example of this new kind of BP Themes, you can check the WIP we've started here: https://github.com/buddypress/buddyvibes

Here's a nice way to start 2024! Happy new year to everyone 🥂

Fixes #8900
Closes https://github.com/buddypress/buddypress/pull/104

M src/bp-core/bp-core-actions.php
M src/bp-core/bp-core-catchuri.php
M src/bp-core/bp-core-template-loader.php
M src/bp-core/bp-core-theme-compatibility.php

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/bp-core-catchuri.php

    r13522 r13686  
    7070 *
    7171 * @since 1.0.0
     72 * @since 14.0.0 Uses `locate_block_template()` to support BuddyPress Block only Themes.
    7273 *
    7374 * @param array $templates Array of templates to attempt to load.
     
    9596    // Only perform template lookup for bp-default themes.
    9697    if ( ! bp_use_theme_compat_with_current_theme() ) {
    97         $template = locate_template( (array) $filtered_templates, false );
     98        if ( bp_theme_compat_is_block_theme() ) {
     99            // Prevent BuddyPress components from using the BP Theme Compat feature.
     100            remove_all_actions( 'bp_setup_theme_compat' );
     101
     102            $block_templates = array();
     103            foreach ( (array) $templates as $template ) {
     104                $block_templates[] = 'buddypress/' . $template;
     105            }
     106
     107            $template_type     = 'buddypress';
     108            $block_templates[] = $template_type;
     109
     110            $template = locate_block_template( '', $template_type, $block_templates );
     111
     112        } else {
     113            $template = locate_template( (array) $filtered_templates, false );
     114        }
    98115
    99116    // Theme compat doesn't require a template lookup.
     
    124141    }
    125142
    126     if ( !empty( $located_template ) ) {
     143    if ( ! empty( $located_template ) ) {
    127144        // Template was located, lets set this as a valid page and not a 404.
    128145        status_header( 200 );
Note: See TracChangeset for help on using the changeset viewer.