0

In my child theme I have:

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    //Load Bootstrap and 3rd Party
    wp_enqueue_style( 'bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css' );
    wp_enqueue_style( 'fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' );
    wp_enqueue_style( 'select2css', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css' );
    // Load our main stylesheet.
    wp_enqueue_style( 'less-style', '/css/style.less' );
}

All the external stylesheets at the top load correctly but the less stylesheet causes 500 error.

The only other time I've done this was in a non-child theme and I had:

function themename_scripts() {
    // Add custom fonts, used in the main stylesheet.
    wp_enqueue_style( 'themename-fonts', themename_fonts_url(), array(), null );
    // Add Genericons, used in the main stylesheet.
    wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' );
    //Load Bootstrap and 3rd Party
    wp_enqueue_style( 'themename-bootstrap', '//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css', array( 'themename-style' ), '20141010' );
    wp_enqueue_style( 'themename-fontawesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array( 'themename-style' ), '20141010' );
    wp_enqueue_style( 'themename-select2', '//cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css', array( 'themename-style' ), '20141010' );
    // Load our main stylesheet.
    wp_enqueue_style( 'themename-style', get_stylesheet_uri() );
    wp_enqueue_style( 'less-style', get_template_directory_uri() . '/css/style.less' );
}
add_action( 'wp_enqueue_scripts', 'themename_scripts' );

And this worked just fine when it wasn't a child theme. What am I missing in the child-theme on top?

2

Per comments get_stylesheet_directory_uri() gets the current template (child in this case) directory, eg

// Load our main stylesheet.
wp_enqueue_style( 'less-style', get_stylesheet_directory_uri() . '/css/style.less' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.