how to add css in child theme in wordpress code example

Example 1: wordpress enqueue style child theme

// To enqueue the WordPress way your CSS sources
// INSIDE your theme/child functions.php:

function wp_starter_scripts() {
	wp_enqueue_style( 'wp-style-menu', get_template_directory_uri() . '/style-menu.css' );
	wp_enqueue_style( 'wp-style-buttons', get_template_directory_uri() . '/style-buttons.css' );
	wp_enqueue_style( 'wp-style-footer', get_template_directory_uri() . '/style-footer.css' );
  }
add_action( 'wp_enqueue_scripts', 'wp_starter_scripts' );

Example 2: create child theme in wordpress

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( 'parenthandle' ), 
        wp_get_theme()->get('Version') // this only works if you have Version in the style header
    );
}

Tags:

Css Example