• Resolved klewis

    (@blackawxs)


    I have the following setup for my enqueueing stylesheets from my child theme…

    function my_theme_enqueue_styles() {
    
      $parenthandle = 'twenty-twenty-one-style'; 
      // This is 'twenty-twenty-one-style' for the Twenty Twenty-one theme.
      $theme = wp_get_theme();
    
      wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( $parenthandle ),
        $theme->get('Version') // this only works if you have Version in the style header
      );
    
      wp_enqueue_style('child_style', get_stylesheet_directory_uri() . '/dist/css/kl_wp_bundle.css',
        array('kl-theme-style'),
        '1.1.0',
        'all');
    
      wp_enqueue_script('fontawesome-script','https://kit.fontawesome.com/fcb2d73aa0.js',
        array(),
        NULL, true
      );
    }
    add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
    

    Everything is loading on the front end, except for my custom stylesheet kl_wp_bundle.css. Is any part that coding area incorrect?

    • This topic was modified 2 years, 8 months ago by klewis.
Viewing 1 replies (of 1 total)
  • Thread Starter klewis

    (@blackawxs)

    Sorry for the quick reply. I solved my issue. I had to use the following format to have my custom stylesheet load after the style.css file on my site. All good now.

    php
      wp_enqueue_style('child-theme', get_stylesheet_directory_uri() . '/dist/css/kl_wp_bundle.css',
        array( $parenthandle ),
        '1.1.0',
        'all');
    
Viewing 1 replies (of 1 total)
  • The topic ‘How to enqueue custom stylesheet for child theme’ is closed to new replies.