Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/13/2021 02:33:37 PM (2 years ago)
Author:
imath
Message:

WP FSE Compat: make sure BuddyPress templates are loaded on front-end

Adapt the BuddyPress Theme Compat API so that it uses the WordPress block template canvas when the active theme supports block templates. You can now test BuddyPress inside Twenty Twenty-Two: the next WordPress default theme!

Improves the BP Nouveau Template Pack introducing a new function bp_nouveau_get_theme_layout_widths() to get the theme layout available widths and use the wider one by default.

See #8474

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress-functions.php

    r13089 r13145  
    177177        add_action( 'bp_actions', array( $this, 'neutralize_core_template_notices' ), 6 );
    178178
    179         // Scripts.
    180         add_action( 'bp_enqueue_scripts', array( $this, 'register_scripts' ), 2 ); // Register theme JS.
     179        // Scripts & Styles.
     180        $registration_params = array(
     181            'hook'     => 'bp_enqueue_scripts',
     182            'priority' => 2,
     183        );
     184
     185        /*
     186         * The WordPress Full Site Editing feature needs Scripts
     187         * and Styles to be registered earlier.
     188         */
     189        if ( current_theme_supports( 'block-templates' ) ) {
     190            $registration_params['hook']     = 'bp_init';
     191            $registration_params['priority'] = 20;
     192        }
     193
     194        // Register theme JS.
     195        add_action( $registration_params['hook'], array( $this, 'register_scripts' ), $registration_params['priority'] );
     196
     197        // Enqueue theme CSS.
     198        add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
     199
     200        // Enqueue theme JS.
     201        add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
     202
     203        // Enqueue theme script localization.
     204        add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) );
    181205        remove_action( 'bp_enqueue_scripts', 'bp_core_confirmation_js' );
    182         add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_styles' ) ); // Enqueue theme CSS.
    183         add_action( 'bp_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); // Enqueue theme JS.
    184         add_filter( 'bp_enqueue_scripts', array( $this, 'localize_scripts' ) ); // Enqueue theme script localization.
    185206
    186207        // Body no-js class.
Note: See TracChangeset for help on using the changeset viewer.