I actually managed to solve this right now!
I changed the “$in_footer” to false, as I was saying earlier that it might be loading in the wrong sequence.
wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, false);
}
Is there any reason that I wouldn’t want to load this in the header?
Cheers
I’ve added an unmodified version of avia.js to my child theme to check if it’s the code, and enqueues it like Josue is describing in post #360250,
// Replace avia.js
function change_aviajs() {
wp_dequeue_script( 'avia-default' );
wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true );
}
add_action( 'wp_enqueue_scripts', 'change_aviajs', 100 );
but still no luck. I’m wondering if it’s loading in the wrong sequence?
Other functions are working correctly though, so this is abit of a headache.
Cheers