Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
February 7, 2022 at 5:48 pm #1339412
I’m trying to overwrite the “avia-snippet-lightbox.js” activation and the “avia-snippet-megamenu.js” in my child theme but without success. What I got so far from the forum was:
function wp_change_lightbox_activation_js() { wp_dequeue_script( 'avia-lightbox-activation-js', get_template_directory().'/js/avia-snippet-lightbox.js', array('jquery')); wp_deregister_script( 'avia-lightbox-activation-js', get_template_directory().'/js/avia-lightbox-activation-js', array('jquery')); wp_enqueue_script( 'child-lightbox-activation-js', get_stylesheet_directory_uri().'/js/avia-lightbox-activation-js', array('jquery')); } add_action( 'wp_enqueue_scripts', 'wp_change_lightbox_activation_js', 100 );
This brings zero effect. Is there a solution? Thanks for your help.
- This topic was modified 2 years, 10 months ago by conflock.
February 8, 2022 at 7:46 am #1339532Hey conflock,
Thank you for the inquiry.
The wp_deregister_script only accepts one parameter or argument, which is the script name or handle, so the code above is invalid. You should also check the file name and its path.
Did you copy the avia-snippet-megamenu.js and the avia-snippet-lightbox.js files in the js folder of the child theme directory? Please try to replace the code with this one.
function ava_change_wp_enqueue_scripts_mod() { wp_deregister_script( 'avia-lightbox-activation' ); wp_deregister_script( 'avia-megamenu' ); wp_enqueue_script( 'avia-child-lightbox-activation', get_stylesheet_directory_uri() . '/js/avia-snippet-lightbox.js', array('jquery')); wp_enqueue_script( 'avia-child-megamenu', get_stylesheet_directory_uri() . '/js/avia-snippet-megamenu.js', array('jquery')); } add_action( 'wp_enqueue_scripts', 'ava_change_wp_enqueue_scripts_mod', 100 );
Make sure that the script files is in the child theme’s js folder.
Best regards,
IsmaelFebruary 8, 2022 at 2:56 pm #1339625Thanks a lot!!!
February 9, 2022 at 6:13 am #1339698 -
AuthorPosts
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.