Load jQuery and dependent JS libraries from function.php

<?php
wp_enqueue_script('jquery');

if (!function_exists('load_theme_scripts')) {
    function load_theme_scripts(){
        wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/js/custom.js', array('jquery'), '1.0.0', true );
    }
    add_action("wp_enqueue_scripts", "load_theme_scripts");
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *