Skip to content

Instantly share code, notes, and snippets.

@landbryo
Last active June 4, 2018 20:42
Show Gist options
  • Save landbryo/e4fd2234759d76c4c06b47e4281c6be8 to your computer and use it in GitHub Desktop.
Save landbryo/e4fd2234759d76c4c06b47e4281c6be8 to your computer and use it in GitHub Desktop.
If you are using the Enfold WordPress theme, it is likely that you'll need to make modifications to its main script avia.js. This is how you can safely copy the avia.js file to your child theme and make modifications.
/* enqueue child script if not in dashboard */
if (!(is_admin())) {
function change_aviajs() {
wp_enqueue_script( 'avia-default-child', get_stylesheet_directory_uri().'/js/avia.js', array('jquery'), 2, true );
}
add_action( 'wp_print_scripts', 'change_aviajs', 100 );
}
/* dequeue child script */
function dequeue_aviajs() {
wp_dequeue_script( 'avia-default' );
}
add_action( 'wp_print_scripts', 'dequeue_aviajs', 100 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment