wp enqueue styles enqueue wordpress wordpress enqueue script enqueue styles and scripts in wordpress

The solution for “wp enqueue styles enqueue wordpress wordpress enqueue script enqueue styles and scripts in wordpress” can be found here. The following code will assist you in solving the problem.

/**
* Enqueue your theme styles and scripts in functions.php
* use time() instead of a proper versioning to avoid caching when developing
*/
function my_theme_enqueue_scripts() {
wp_enqueue_style( ‘default-style’, get_stylesheet_uri(), [], ‘1.0.0’, ‘all’ ); //default styles.css
wp_enqueue_style( ‘main-style’, get_stylesheet_directory_uri() . ‘/assets/css/main.min.css’, [], time(), ‘all’ );
wp_enqueue_script( ‘main-script’, get_stylesheet_directory_uri() . ‘/assets/js/main.min.js’, [], time(), false );
}
add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_scripts’ );
function wpdocs_theme_name_scripts() {
wp_enqueue_style( ‘style-name’, get_stylesheet_uri() ); /* enqueues style.css */
/* if you want to enqueue other styles use: */
/* wp_enqueue_style( ‘style-name’, get_template_directory_uri() . ‘/css/your-style-name.css’ ); */
wp_enqueue_script( ‘script-name’, get_template_directory_uri() . ‘/js/example.js’, array(), ‘1.0.0’, true );
}
add_action( ‘wp_enqueue_scripts’, ‘wpdocs_theme_name_scripts’ );wp_enqueue_style( ‘slider’, get_template_directory_uri() . ‘/css/slider.css’,false,’1.1′,’all’);
enqueue

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in