Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/02/2018 10:13:58 PM (4 years ago)
Author:
djpaul
Message:

Core: allow theme to override site's template pack choice.

As part of the work for Nouveau, we need a way to let a theme override the site template pack setting.
e.g. new themes could force the "nouveau" template pack.

The syntax is buddypress-use-foobar, where "foobar" is the slug name of the template pack.
e.g. buddypress-use-legacy, buddypress-use-nouveau.

Fixes #7730

File:
1 edited

Legend:

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

    r11841 r11936  
    988988}
    989989add_action( 'loop_end', 'bp_theme_compat_loop_end' );
     990
     991/**
     992 * Maybe override the preferred template pack if the theme declares a dependency.
     993 *
     994 * @since 3.0.0
     995 */
     996function bp_check_theme_template_pack_dependency() {
     997    $all_packages = array_keys( buddypress()->theme_compat->packages );
     998
     999    foreach ( $all_packages as $package ) {
     1000        // e.g. "buddypress-use-nouveau", "buddypress-use-legacy".
     1001        if ( ! current_theme_supports( "buddypress-use-{$package}" ) ) {
     1002            continue;
     1003        }
     1004
     1005        bp_setup_theme_compat( $package );
     1006        return;
     1007    }
     1008}
Note: See TracChangeset for help on using the changeset viewer.