• Resolved queena427

    (@queena427)


    Hello,

    I have two stylesheets in my child theme. Style.css in the root directory which loads fine and slider.css in /inc/css. Slider.css does not load. Below is my functions.php file. Any help is much appreciated.

    Site: cheekycelie.com

    <?php
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’, 9999 );
    function my_theme_enqueue_styles() {
    wp_enqueue_style( ‘parent-style’, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘slider-style’, get_template_directory_uri() . ‘/inc/css/slider.css’ );
    }
    ?>

    This is at the top of my child theme slider.css file:
    /*
    Theme Name: SG Window
    Theme URI: http://www.wordpress.org/wp-content/themes/sg-window-child/
    Description: SG Window Child Theme
    Author: April Ambroise
    Author URI: http://cheekycelie.com
    Template: sg-window
    Version: 1.0.0
    License: GNU General Public License v2 or later
    License URI: http://www.gnu.org/licenses/gpl-2.0.html
    Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
    Text Domain: sg-window-child
    */

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi queena427,

    I normally use @import to add the other css files directly in style.css.
    @import url(‘inc/css/slider.css’);

    Hope it helps.

    Thread Starter queena427

    (@queena427)

    Hi tangentdesign,

    Thank you. I’m trying to avoid @import because I read the wpenqueue method is preferred.

    Thanks

    — Does anyone know why I’m still loading the parent slider.css file? I must be missing a line in the functions.php file or something.

    Hi,

    It makes sense not to using @import.

    So try with this :

    <?php
    function my_theme_enqueue_styles() {
    $parent_style = ‘parent-style’;
    wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’, get_stylesheet_directory_uri() . ‘/style.css’, array( $parent_style ) );
    wp_enqueue_style( ‘child-1-style’, get_stylesheet_directory_uri().’/inc/css/slider.css’, array(‘child-style’));
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    ?>

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Multiple stylesheets in child theme – Not all loading’ is closed to new replies.