Skip to:
Content

BuddyPress.org

Changeset 4027


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

Location:
trunk
Files:
3 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' );
  • trunk/bp-core/bp-core-cssjs.php

    r4018 r4027  
    11<?php
    2 
    3 /**
    4  * bp_core_add_admin_bar_css()
    5  *
    6  * Add the CSS needed for the admin bar on blogs (other than the root) and in the admin area.
    7  *
    8  * @package BuddyPress Core
    9  * @uses get_option() Selects a site setting from the DB.
    10  */
    11 function bp_core_add_admin_bar_css() {
    12     global $bp, $current_blog;
    13 
    14     if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
    15         return false;
    16 
    17     if ( ( is_multisite() && $current_blog->blog_id != BP_ROOT_BLOG ) || is_admin() ) {
    18         $stylesheet = get_blog_option( BP_ROOT_BLOG, 'stylesheet' );
    19 
    20         if ( file_exists( WP_CONTENT_DIR . '/themes/' . $stylesheet . '/_inc/css/adminbar.css' ) )
    21             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 );
    22         else
    23             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 );
    24     }
    25 }
    26 add_action( 'bp_init', 'bp_core_add_admin_bar_css' );
    27 
    282/**
    293 * bp_core_admin_menu_icon_css()
  • trunk/bp-themes/bp-default/style.css

    r3771 r4027  
    2222 */
    2323@import url( _inc/css/default.css );
    24 
    25 /***
    26  * The admin bar default styles
    27  */
    28 @import url( _inc/css/adminbar.css );
Note: See TracChangeset for help on using the changeset viewer.