You are currently viewing Link css and js file in wordpress child theme

Link css and js file in wordpress child theme

WordPress provides a mechanism to customize themes as per your need without changing main theme code by creating child theme of that theme. Child theme requires many external css and js file to add extra functionality in it. Use below code to link css and js file to your child theme.

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

function theme_enqueue_styles() {

     wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css' );

    wp_enqueue_script( 'script_js', get_stylesheet_directory_uri() . '/js/script.js', array( 'jquery' ), '1.0', true );

    wp_enqueue_script( 'script_wishlist', get_stylesheet_directory_uri() . '/woocommerce/wishlist.js', array( 'wishlist' ), '1.0', true );

}

Leave a Reply