Wednesday, January 18, 2023
HomeWordPress Developmentphp - hyperlinks Slick jS library utilizing wp_enqueue_scripts not pulling

php – hyperlinks Slick jS library utilizing wp_enqueue_scripts not pulling


The error within the console also needs to present the URL that it is making an attempt to load. For those who have a look at that it’s best to see that it is making an attempt to load from the mum or dad theme, however you are presumably making an attempt to load it from the kid theme.

The problem is that you just’re utilizing get_template_directory_uri(), which will get the URL to the mum or dad theme. To get the URL to the kid theme you might want to use get_stylesheet_directory_uri().

That being mentioned, the higher capabilities to make use of lately are literally get_parent_theme_file_uri() and get_theme_file_uri(). The latter is what you need to use on this case:

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
perform my_theme_enqueue_styles() {
    wp_register_style( 'slick-css', get_theme_file_uri( 'property/src/library/css/slick.css' ) );
    wp_register_style( 'slick-theme-css', get_theme_file_uri( 'property/src/library/css/slick-theme.css' ) );
    wp_enqueue_script( 'jquery-min-js', get_theme_file_uri( 'property/src/library/js/jquery-1.11.0.min.js' ), array(), '1.11.0' );
    wp_enqueue_script( 'slick-min-js', get_theme_file_uri( 'property/src/library/js/slick.min.js' ) );

    // Enqueue all CSS & JS recordsdata
    wp_enqueue_style( 'slick-css' );
    wp_enqueue_style( 'slick-theme-css' );
    wp_enqueue_script( 'jquery-min-js' );
    wp_enqueue_script( 'slick-min-js' );
    wp_enqueue_script( 'myscript-js' );
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments