Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/28/2011 11:43:37 PM (15 years ago)
Author:
djpaul
Message:

Move buddybar CSS out of BP-Default.
Maintain backpat for any child theme customisations. Add minified versions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-buddybar.php

    r4409 r4436  
    471471 * Handle the Admin Bar/BuddyBar business
    472472 *
     473 * @global num $wp_version
    473474 * @todo Clean up global constants
    474  *
    475  * @global num $wp_version
    476475 */
    477476function bp_core_load_admin_bar() {
     
    492491
    493492                // Admin bar styles
    494                 $stylesheet = get_blog_option( BP_ROOT_BLOG, 'stylesheet' );
    495 
    496                 if ( file_exists( WP_CONTENT_DIR . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) )
    497                         wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', WP_CONTENT_URL . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ), array(), BP_VERSION );
    498                 else
    499                         wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', BP_PLUGIN_URL . '/bp-themes/bp-default/_inc/css/adminbar.css' ), array(), BP_VERSION );
     493                if ( file_exists( get_stylesheet_directory() . '/_inc/css/adminbar.css' ) ) // Backwards compatibility
     494                        $stylesheet = get_stylesheet_directory_uri() . '/_inc/css/adminbar.css';
     495                elseif ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     496                        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar.dev.css';
     497                else
     498                        $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar.css';
     499
     500                wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', $stylesheet ), array(), BP_VERSION );
    500501
    501502                // Actions used to build the BP admin bar
     
    512513}
    513514
     515/**
     516 * Load the buddybar's RTL stylesheet if appropriate.
     517 *
     518 * This can't be done in bp_core_load_admin_bar() because that function is called before locale.php is included.
     519 *
     520 * @since 1.3
     521 */
     522function bp_core_load_buddybar_rtl_stylesheet() {
     523        if ( !is_rtl() )
     524                return;
     525
     526        if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG )
     527                $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar-rtl.dev.css';
     528        else
     529                $stylesheet = BP_PLUGIN_URL . '/bp-core/css/buddybar-rtl.css';
     530
     531        wp_enqueue_style( 'bp-admin-bar-rtl', apply_filters( 'bp_core_buddybar_rtl_css', $stylesheet ), array( 'bp-admin-bar' ), BP_VERSION );
     532}
     533add_action( 'wp', 'bp_core_load_buddybar_rtl_stylesheet' );
    514534?>
Note: See TracChangeset for help on using the changeset viewer.