Skip to:
Content

BuddyPress.org

Changeset 9629


Ignore:
Timestamp:
03/20/2015 01:01:18 PM (10 years ago)
Author:
djpaul
Message:

BP-Legacy: when loading RTL CSS, don't also load the LTR CSS.

Unlike WordPress, our RTL is a clone of the LTR file, instead of containing just the RTL adjustments.

wp_enqueue_style's RTL support works the WordPress way, not the BuddyPress way, so some of the logic has needed to be duplicated.
We maintain backwards compatibility with the style's existing script names in case existing sites have explicitly de-registered these styles already.

Fixes #6200

File:
1 edited

Legend:

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

    r9604 r9629  
    207207
    208208        // Locate the BP stylesheet
    209         $asset = $this->locate_asset_in_stack( "buddypress{$min}.css", 'css' );
    210 
    211         // Enqueue BuddyPress-specific styling, if found
    212         if ( isset( $asset['location'], $asset['handle'] ) ) {
    213             wp_enqueue_style( $asset['handle'], $asset['location'], array(), $this->version, 'screen' );
    214 
    215             wp_style_add_data( $asset['handle'], 'rtl', true );
     209        $ltr = $this->locate_asset_in_stack( "buddypress{$min}.css",    'css' );
     210        $rtl = $this->locate_asset_in_stack( "buddypress-rtl{$min}.css", 'css' );
     211
     212        // LTR
     213        if ( ! is_rtl() && isset( $ltr['location'], $ltr['handle'] ) ) {
     214            wp_enqueue_style( $ltr['handle'], $ltr['location'], array(), $this->version, 'screen' );
     215
    216216            if ( $min ) {
    217                 wp_style_add_data( $asset['handle'], 'suffix', $min );
     217                wp_style_add_data( $ltr['handle'], 'suffix', $min );
     218            }
     219        }
     220
     221        // RTL
     222        if ( is_rtl() && isset( $rtl['location'], $rtl['handle'] ) ) {
     223            $rtl['handle'] = str_replace( '-css', '-css-rtl', $rtl['handle'] );  // Backwards compatibility
     224            wp_enqueue_style( $rtl['handle'], $rtl['location'], array(), $this->version, 'screen' );
     225
     226            if ( $min ) {
     227                wp_style_add_data( $rtl['handle'], 'suffix', $min );
    218228            }
    219229        }
Note: See TracChangeset for help on using the changeset viewer.