Changing location of style.css in child theme

Just started working with BB and love it. I’m using SASS, and I want to organize the assets (css, js, etc) in the child theme under a library folder (bb-theme-child/library) which has the following sub-dirs:

/css (for style.css)
/scss (all my scss files)
/js (for any js I’m enqueing)
etc…

I’m keeping a blank style.css in the root of the child theme to satisfy WordPress, and have changed the following line in functions.php:

static public function stylesheet()
{
echo ‘<link rel=“stylesheet” href="’ . FL_CHILD_THEME_URL . ‘/library/css/style.css"/>’;
}

Is there anything else I should change (e.g. functions.php) to ensure the styles are being referenced properly? I noticed that any changes I now make in the customizer are not being saved now.

Hey Glen,

Welcome to the BB forums! :slight_smile:

You’ll want to enqueue the style using the wp_enqueue_script as recommended by WP. Check the function below.

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
  wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}

Ben

<forehead slap> Of course! Thank you for the ninja-fast response. Going to get a strong(er) cup of coffee now.

Enjoy The Beaver! :wink:

Hi Ben,

The only problem with using the hook is that you can’t override the customizer settings because the generated css from the customizer is directly added to the theme in the header.php.

<?php 
wp_head(); 
FLTheme::head();
?>
</head>

I can’t think of a way around this other than making my CSS code more specific, but I would much rather simply be able to add my CSS file below the CSS that the theme generates.

Any ideas?

Thanks,
Tom

Try changing the proiority of the hook – https://codex.wordpress.org/Function_Reference/add_action#Parameters

or use add_action(‘fl_head’) – http://forum.wpbeaverbuilder.com/knowledge-base/theme-action-reference/