Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2011 10:36:57 PM (13 years ago)
Author:
djpaul
Message:

Enqueue buddybar's CSS in core rather than the theme to prevent unstyled mess when using third-party themes

File:
1 edited

Legend:

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

    r3982 r4027  
    295295    global $bp;
    296296
    297     if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
     297    if ( defined( 'BP_DISABLE_ADMIN_BAR' ) && BP_DISABLE_ADMIN_BAR )
    298298        return false;
    299299
     
    450450        // TODO: Add BP support to WP admin bar
    451451        return;
     452
    452453    } elseif ( !defined( 'BP_DISABLE_ADMIN_BAR' ) || !BP_DISABLE_ADMIN_BAR ) {
    453454        // Keep the WP admin bar from loading
    454455        show_admin_bar( false );
    455456
     457        // Admin bar styles
     458        $stylesheet = get_blog_option( BP_ROOT_BLOG, 'stylesheet' );
     459
     460        if ( file_exists( WP_CONTENT_DIR . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) )
     461            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 );
     462        else
     463            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 );
     464       
    456465        // Actions used to build the BP admin bar
    457466        add_action( 'bp_adminbar_logo',  'bp_adminbar_logo' );
Note: See TracChangeset for help on using the changeset viewer.