kldesigns
9/14/2017 - 3:52 AM

add js to wp

how to add js scripts to wp sites. Create a js directory in the theme directory then add this to functions.php for the theme

<?php
function site_functions_js() {
    wp_enqueue_script(
        'site_functions',
        get_template_directory_uri() . '/js/functions.js',
        array('jquery')
    );
}
add_action('wp_enqueue_scripts', 'site_functions_js');
?>