[buddypress-trac] [BuddyPress] #3389: Enqueueing CSS of bp-default breaks child theme layouts

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Mon Aug 15 21:10:05 UTC 2011


#3389: Enqueueing CSS of bp-default breaks child theme layouts
---------------------+------------------------------
 Reporter:  mercime  |       Owner:
     Type:  defect   |      Status:  new
 Priority:  normal   |   Milestone:  Awaiting Review
Component:  Theme    |     Version:  1.5
 Severity:  normal   |  Resolution:
 Keywords:           |
---------------------+------------------------------

Comment (by karmatosed):

 Using a function like this is pretty standard now - most themes will have
 a setup function and others like this.

 I'd say it's about getting inline with best practices in part but also
 it's not a case of having to deregister.  In this function you just don't
 have it called and it won't enqueue.  See my above example no
 unregistering going on.  It's actually more flexible if about face and
 certainly more future proof using the !function_exists check (below code
 is the call in default):


 {{{
 if ( !function_exists( 'bp_dtheme_enqueue_styles' ) ) :
 /**
  * Enqueue theme CSS safely
  *
  * @see http://codex.wordpress.org/Function_Reference/wp_enqueue_style
  * @since 1.5
  */
 function bp_dtheme_enqueue_styles() {
         // Bump this when changes are made to bust cache
         $version = '20110804';

         // Default CSS
         wp_enqueue_style( 'bp-default-main', get_template_directory_uri()
 . '/_inc/css/default.css', array(), $version );

         // Right to left CSS
         if ( is_rtl() )
                 wp_enqueue_style( 'bp-default-main-rtl',
 get_template_directory_uri() . '/_inc/css/default-rtl.css', array( 'bp-
 default-main' ), $version );
 }
 add_action( 'wp_print_styles', 'bp_dtheme_enqueue_styles' );
 endif;

 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3389#comment:12>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list