@gregfielding I know what you mean
As DJPaul mentioned here, child themes can declare and empty function to override parent theme’s function. Check out Boone’s solution – a proposed patch which works of course and is better IMHO.
You might have noticed that the link to stylesheet is no longer in bp-default theme’s header.php. Hence, you could either add the link to stylesheet in child theme’s header.php or enqueue main stylesheet ala bp-default theme.
Cheers.
Thanks mercime. Was there a solution in there for the adminbar css? I read through it all and it looks like that part is still up in the air…
This is going to be a nightmare when I go to upgrade my main existing community…
You can deregister adminbar.css and adminbar-rtl.css by adding this to functions.php
`//Deregister enqueued admin styles
function greg_deregister_admin_styles() {
wp_deregister_style( ‘bp-admin-bar’ );
wp_deregister_style( ‘bp-admin-bar-rtl’ );
}
add_action( ‘wp_print_styles’, ‘greg_deregister_admin_styles’, 20 );`
@gregfielding disregard previous post … to disable BP’s Admin Bar aka buddybar, just add this to functions.php
`remove_action( ‘bp_init’, ‘bp_core_load_buddybar_css’ );`
@mercime
The first option removed the buddybar. The second resulted in an error message:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘bp_core_load_buddybar_css’ was given in /home/housings/public_html/townswell.com/wp-includes/plugin.php on line 405
To clarify, I don’t want to remove it, I just want to be able to restyle it with my own child theme css.
@gregfielding my bad, that code above was for BP 1.5 beta 3 and this only prevents the adminbar.css from being enqueued via wp_head. So you can definitely use your own adminbar.css by @import in style.css of child theme or enqueueing it, whichever you prefer.
@gregfielding: Could you let me know what step I’m missing or applying incorrectly? I have the same issue that you mentioned in your original post. So, after reading all of the recommended material regarding creating a child theme for BP 1.5 Beta 1 thru 3, the styling in my child’s style.css file still won’t be recognized (And I’m still in a slowly clearing fog. Too slow.). Here’s what I did:
1. Created my child theme folder,
2. In that I created a blank functions.php file and then added to it:
`<?php
if ( !function_exists( ‘bp_dtheme_enqueue_styles’ ) ) :
function bp_dtheme_enqueue_styles() {}
endif;
?>`
3. I reloaded my browser, and the default styling isn’t there. Great.
4. Now, to my child’s style.css file, I do what I’ve done before and add the @import code:
@import url( ../../plugins/buddypress/bp-themes/bp-default/_inc/css/default.css );
5. I did Step 4 because I want to load and override the default styling, not start from scratch.
Could you point me in the right direction? Thanks.
So the code in my previous post doesn’t show. Since then, this is what I’ve included in my child theme’s functions.php file (and I have NOT done an @import within my style.css file):
http://chopapp.com/#2s3gjzs6
This seems to work. Is the syntax for enqueuing the style.css file correct? Is this the right way to do it? Thanks.
By the way, I see that other folks are able to paste code into the comments/replies. I don’t know how to do that, hence the link. Could someone enlighten me?
@qrahaman – to post code here, you have to wrap it with backticks as seen within the parentheses ( ` )
We have initial docs on styling for BP 1.5 https://codex.buddypress.org/releases/1-5-developer-and-designer-information/
@mercime. Thanks!
Okay, that referenced information is what I stared at for a long time (I’m really new at this…) and the following is what I came up with:
`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 );
wp_enqueue_style( ‘bp-child-style’, get_stylesheet_directory_uri() . ‘/style.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’ );`
You may notice that in the second enqueue statement, I used `get_stylesheet_directory_uri()` to pull the child’s directory. Is that correct? No where in the referenced information does it use that function, only `get_template_directory_uri()` which presumably pulls the parent directory. Given that the directory function I used was not in the referenced information, I wonder if there is alternative, straightforward way that a seasoned developer would use.
If you want to use the child style yes that’s what you need to do