Skip to:
Content

BuddyPress.org

Ticket #3389: 3384.04.patch

File 3384.04.patch, 1.5 KB (added by r-a-y, 15 years ago)
  • bp-themes/bp-default/functions.php

    function bp_dtheme_setup() {  
    126126                if ( bp_is_active( 'blogs' ) )
    127127                        add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
    128128        }
     129
     130        add_action( 'get_header', 'ob_start', 0 );
    129131}
    130132add_action( 'after_setup_theme', 'bp_dtheme_setup' );
    131133endif;
    … … if ( !function_exists( 'bp_dtheme_enqueue_styles' ) ) :  
    177179 * @since 1.5
    178180 */
    179181function bp_dtheme_enqueue_styles() {
     182        // save output buffer into a variable
     183        $buffer = ob_get_contents();
     184
     185        // stop output buffering
     186        ob_end_clean();
     187
     188        // backpat: check to see if a stylesheet was hardcoded into header.php
     189        // if so, echo the output buffer without the hardcoded stylesheet and enqueue it
     190        if ( strpos( $buffer, 'style.css' ) !== false ) {
     191                // replace hardcoded stylesheet with nothing
     192                echo str_replace( '<link rel="stylesheet" href="' . get_bloginfo( 'stylesheet_url' ) . '" type="text/css" media="screen" />', '', $buffer );
     193                // Now properly enqueue the child theme's stylesheet
     194                wp_enqueue_style( get_stylesheet(), get_stylesheet_uri(), array() );
     195               
     196                // stop the rest of this function
     197                return;
     198        }
     199
     200        // we still need to output the saved buffer, then we continue as usual!
     201        echo $buffer;
     202
    180203        // Bump this when changes are made to bust cache
    181204        $version = '20110830';
    182205