1function wpdocs_theme_name_scripts() {
2 wp_enqueue_style( 'style-name', get_stylesheet_uri() ); /* enqueues style.css */
3 /* if you want to enqueue other styles use: */
4 /* wp_enqueue_style( 'style-name', get_template_directory_uri() . '/css/your-style-name.css' ); */
5 wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
6}
7add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
1function script_that_requires_jquery() {
2 wp_register_script( 'script-with-dependency', 'http://www.example.com/script-with-dependency.js', array( 'jquery' ), '1.0.0', true );
3 wp_enqueue_script( 'script-with-dependency' );
4}
5add_action( 'wp_enqueue_scripts', 'script_that_requires_jquery' );
1/**
2 * Proper way to enqueue scripts and styles
3 */
4function wpdocs_theme_name_scripts() {
5 wp_enqueue_style( 'style-name', get_stylesheet_uri() );
6 wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
7}
8add_action( 'wp_enqueue_scripts', 'wpdocs_theme_name_scripts' );
9
1wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array ( 'jquery' ), 1.1, true);
2
1function add_theme_scripts() {
2 wp_enqueue_style( 'style', get_stylesheet_uri() );
3
4 wp_enqueue_style( 'slider', get_template_directory_uri() . '/css/slider.css', array(), '1.1', 'all');
5
6 wp_enqueue_script( 'script', get_template_directory_uri() . '/js/script.js', array ( 'jquery' ), 1.1, true);
7
8 if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
9 wp_enqueue_script( 'comment-reply' );
10 }
11}
12add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );
13
1wp_enqueue_style( 'slider', get_template_directory_uri() . '/css/slider.css',false,'1.1','all');
2