// Step 1: Define a function to enqueue your JavaScript file
function enqueue_custom_script() {
// Step 2: Specify the path to your JavaScript file
$script_path = get_template_directory_uri() . '/js/custom-script.js';
// Step 3: Enqueue the script with a unique handle, specify dependencies, and set version
wp_enqueue_script('custom-script', $script_path, array('jquery'), '1.0', true);
}
// Step 4: Hook the function to the 'wp_enqueue_scripts' action
add_action('wp_enqueue_scripts', 'enqueue_custom_script');