Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/27/2009 10:41:10 AM (16 years ago)
Author:
apeatling
Message:

Single WP support. Yes, you read that correctly.

File:
1 edited

Legend:

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

    r2206 r2209  
    1010 */
    1111function bp_core_add_admin_bar_css() {
    12     global $current_blog;
     12    global $bp;
    1313
    1414    if ( defined( 'BP_DISABLE_ADMIN_BAR' ) )
    1515        return false;
    1616
    17     /* Fetch the admin bar css from the active theme location */
    18     if ( file_exists( WP_CONTENT_DIR . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) . '/_inc/css/adminbar.css' ) )
    19         $admin_bar_css = WP_CONTENT_URL . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'stylesheet' ) . '/_inc/css/adminbar.css';
    20     else if ( file_exists( WP_CONTENT_DIR . '/' . get_blog_option( BP_ROOT_BLOG, 'template' ) . '/_inc/css/adminbar.css' ) )
    21         $admin_bar_css = WP_CONTENT_URL . '/themes/' . get_blog_option( BP_ROOT_BLOG, 'template' ) . '/_inc/css/adminbar.css';
    22     else
    23         $admin_bar_css = BP_PLUGIN_URL . '/bp-core/css/admin-bar-fallback.css';
    24 
    25     wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', $admin_bar_css ) );
     17    /* Check there is admin bar css in the currently active theme. If not fallback to the css in the plugin. */
     18    if ( !locate_template( array( '_inc/css/adminbar.css' ), false ) )
     19        wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', BP_PLUGIN_URL . '/bp-core/css/admin-bar-fallback.css' ) );
     20    else {
     21        if ( is_admin() )
     22            wp_enqueue_style( 'bp-admin-bar', apply_filters( 'bp_core_admin_bar_css', str_replace( ABSPATH, $bp->root_domain . '/', locate_template( array( '_inc/css/adminbar.css' ), false ) ) ) );
     23    }
    2624}
    27 add_action( 'admin_menu', 'bp_core_add_admin_bar_css' );
    28 add_action( 'template_redirect', 'bp_core_add_admin_bar_css' );
     25add_action( 'init', 'bp_core_add_admin_bar_css' );
    2926
    3027/**
     
    3936    wp_enqueue_script( 'bp-admin-bar-js', BP_PLUGIN_URL . '/bp-core/js/admin-bar.js', array( 'jquery' ) );
    4037}
    41 add_action( 'admin_menu', 'bp_core_add_admin_bar_js' );
    42 add_action( 'wp', 'bp_core_add_admin_bar_js' );
     38add_action( 'init', 'bp_core_add_admin_bar_js' );
    4339
    4440/**
Note: See TracChangeset for help on using the changeset viewer.