Tagged: child theme, javascript
Hello I want to make my child theme load this file js/avia-snippet-lightbox.js from the child theme and not the parent. So I don’t want to load the version of avia-snippet-lightbox.js that is in the parent theme, but rather the one that I put in the same path of the child theme, but it isn’t working. How might I accomplish that?
Hey sasserp01,
Try to add this code at the bottom of your child theme’s functions.php:
function change_lightboxjs() {
wp_dequeue_script( 'avia-lightbox-activation' );
wp_enqueue_script( 'avia-lightbox-activation-child', get_stylesheet_directory_uri().'/js/avia-snippet-lightbox.js', array('avia-default'), 2, true );
}
add_action( 'wp_enqueue_scripts', 'change_lightboxjs', 100 );
Hope it helps.
Best regards,
Nikko