You didn’t mention how you are adding your CSS.
What code are you using to enqueue your CSS?
Hi
Sorry, you are right.
I enqueue my styles from my theme function.php file, in this way:
wp_enqueue_style( 'showcase', get_bloginfo( 'stylesheet_url' ) );
If I use this code in header.php it works:
if ((bp_is_user()) || (bp_current_component('groups')) ){
<link rel='stylesheet' id='showcase-css' href='http://mysite.com/theme/style.css?ver=4.1' type='text/css' media='all' />
}
But if I use this in functions.php not works:
if ((bp_is_user()) || (bp_current_component('groups')) ){
wp_enqueue_style( 'showcase', get_bloginfo( 'stylesheet_url' ) );
}
Obviously, I have found the solution with code in header.php, but I am curious to know what has changed in the buddypress code for this to happen.
Thank you for your attention
Best regards
if ((bp_is_user()) || (bp_current_component('groups')) ){
looks wrong.
Try:
if ( bp_is_user() || bp_is_current_component( 'groups' ) ) {
Also are you running your enqueue styles on the 'wp_enqueue_scripts'
action?
No, it does not work.
Yes, I am running several scripts in this way:
wp_enqueue_script( 'jquery', get_template_directory_uri() . "/js/jquery-1.4.4.min.js", null, '1.4.4', false );
You’re doing something wrong because this is working for me:
function my_enqueue_styles() {
if ( ! function_exists( 'is_buddypress' ) ) {
return;
}
if ( bp_is_user() || bp_is_current_component( 'groups' ) ) {
wp_enqueue_style( 'my-style', get_template_directory_uri() . '/test.css' );
}
}
add_action( 'wp_enqueue_scripts', 'my_enqueue_styles' );
Stylesheet is loaded on member profile pages and group pages only.
there was a conflict with two old functions in functions.php file
add_action( 'wp_print_styles', 'my_deregister_styles', 100 );
function my_deregister_styles() {
if ( is_page('Inscripciones') ) {
wp_deregister_style( 'showcase' );
wp_deregister_style( 'font-titillium' );
wp_deregister_style( 'font-leaguegothic' );
wp_deregister_style( 'ie6' );
wp_deregister_style( 'ie7' );
}
}
add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );
function my_deregister_javascript() {
if ( is_page('Inscripciones') ) {
wp_deregister_script( 'jquery' );
wp_deregister_script( 'hoverIntent' );
wp_deregister_script( 'superfish' );
wp_deregister_script( 'md5' );
wp_deregister_script( 'prettyjs' );
wp_deregister_script( 'jquery.tools' );
}
}
Thank you very much again
Best regards