I add custom css files to my theme, but when I try to do the same for the javascript files, they dont seem to work, this means that the javascript on the html files is working properlly, but if I transfer it to the custom javascript file it doesnt. Am I adding the custom javascript file correctly to wordpress?
if (! function_exists('custom_jsfiles')) {
add_action('wp_enqueue_scripts', 'custom_jsfiles');
function custom_jsfiles() {wp_enqueue_script('custom_js', home_url().'/wp-content/themes/mytheme/custom-js.js');}
}
if (! function_exists('custom_jsfiles')) {
guard?