Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/01/2024 10:56:10 AM (23 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-template-loader.php

    r13519 r13686  
    827827    ) );
    828828}
     829
     830/**
     831 * Sets Block Theme compatibility if it supports BuddyPress.
     832 *
     833 * @since 14.0.0
     834 */
     835function bp_set_block_theme_compat() {
     836    if ( bp_is_running_wp( '5.9.0', '>=' ) && wp_is_block_theme() && current_theme_supports( 'buddypress' ) ) {
     837        bp_deregister_template_stack( 'get_stylesheet_directory', 10 );
     838        bp_deregister_template_stack( 'get_template_directory', 12 );
     839
     840        $block_theme     = wp_get_theme();
     841        $theme_compat_id = $block_theme->stylesheet;
     842
     843        bp_register_theme_package(
     844            array(
     845                'id'             => $theme_compat_id,
     846                'name'           => $block_theme->get( 'Name' ),
     847                'version'        => $block_theme->get( 'Version' ),
     848                'dir'            => '',
     849                'url'            => '',
     850                'is_block_theme' => true,
     851            )
     852        );
     853
     854        bp_setup_theme_compat( $theme_compat_id );
     855    }
     856}
Note: See TracChangeset for help on using the changeset viewer.