Adding or Enqueue Jquery and CSS Right way in WordPress

WordPress comes by default with the latest version of JQuery and it’s relatively easy to add the reference to the scripts and css using a wordpress hook. Just add the code bleow to your functions.php file.

how to enque scripts and css

WordPress comes by default with the latest version of JQuery and it’s relatively easy to add the reference to the scripts and css using a wordpress hook. Just add the code bleow to your functions.php file.

[code language="javascript"]
/**
* Add the JQuery, Scripts and CSS Proper Way
*/
function wp_guru_enque() {
wp_enqueue_style( 'style-name', get_stylesheet_uri() ); // Enqueue style
wp_enqueue_script( 'jquery' ); //Enqueue jquery
wp_enqueue_script( 'script-name', get_template_directory_uri() . '/scripts/script.js', array(), '1.0.0', true ); // Enqueue script
}

add_action( 'wp_enqueue_scripts', 'wp_guru_enque' );
[/code]