Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/04/2020 06:13:48 PM (3 years ago)
Author:
imath
Message:

BP Nouveau gets ready for Twenty Twenty-One

Improve the BP Nouveau template pack to make BuddyPress appearance looks great into the next WordPress default theme (Twenty Twenty-One).

Use the companion stylesheet feature to only load CSS rules specific to Twenty Twenty-One if it is the active theme or the parent of the active theme.

Props vapvarun

Fixes #8395

File:
1 edited

Legend:

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

    r12595 r12814  
    284284            }
    285285        }
     286
     287        // Compatibility stylesheets for specific themes.
     288        $theme                = get_template();
     289        $companion_stylesheet = bp_locate_template_asset( sprintf( 'css/%1$s%2$s.css', $theme, $min ) );
     290        $companion_handle     = 'bp-' . $theme;
     291
     292        if ( ! is_rtl() && isset( $companion_stylesheet['uri'] ) && $companion_stylesheet['uri'] ) {
     293            wp_enqueue_style( $companion_handle, $companion_stylesheet['uri'], array(), $this->version, 'screen' );
     294
     295            if ( $min ) {
     296                wp_style_add_data( $companion_handle, 'suffix', $min );
     297            }
     298        }
     299
     300        // Compatibility stylesheet for specific themes, RTL-version.
     301        if ( is_rtl() ) {
     302            $rtl_companion_stylesheet = bp_locate_template_asset( sprintf( 'css/%1$s-rtl%2$s.css', $theme, $min ) );
     303
     304            if ( isset( $rtl_companion_stylesheet['uri'] ) ) {
     305                $companion_handle .= '-rtl';
     306                wp_enqueue_style( $companion_handle, $rtl_companion_stylesheet['uri'], array(), $this->version, 'screen' );
     307
     308                if ( $min ) {
     309                    wp_style_add_data( $companion_handle, 'suffix', $min );
     310                }
     311            }
     312        }
    286313    }
    287314
Note: See TracChangeset for help on using the changeset viewer.