Solution:
Make sure you give unique handle to all wp_enqueue_script
and wp_enqueue_style
. the first parameter is the handle. you can also remove js based on the handle using wp_dequeue_script
. try below code.
function Twenty_twenty_scripts() {
wp_enqueue_script( 'twentytwenty_script', get_theme_file_uri(), array(), '1.0');
wp_enqueue_script( 'twentytwenty-priority-menu', get_theme_file_uri( '/js/custom- scroll/jquery.mCustomScrollbar.concat.min.js' ), array(), '20181214', true );
wp_enqueue_script( 'bootstrap', get_theme_file_uri( '/js/bootstrap.js' ), array(), '20181231', true );
wp_enqueue_script( 'bootstrap-min', get_theme_file_uri( '/js/bootstrap.min.js' ), array(), '20181214', true );
wp_enqueue_script( 'carousel', get_theme_file_uri( '/js/carousel.js' ), array(), '20181214', true );
wp_enqueue_script( 'carousel-product', get_theme_file_uri( '/js/carousel-product.js' ), array(), '20181214', true );
wp_enqueue_script( 'checkout', get_theme_file_uri( '/js/checkout.js' ), array(), '20181214', true );
wp_enqueue_script( 'color-calculations', get_theme_file_uri( '/js/color-calculations.js' ), array(), '20181214', true );
wp_enqueue_script( 'core', get_theme_file_uri( '/js/core.js' ), array(), '20181214', true );
wp_enqueue_script( 'customize', get_theme_file_uri( '/js/customize.js' ), array(), '20181214', true );
wp_enqueue_script( 'customize-controls', get_theme_file_uri( '/js/customize-controls.js' ), array(), '20181214', true );
wp_enqueue_script( 'customize-preview', get_theme_file_uri( '/js/customize-preview.js' ), array(), '20181214', true );
wp_enqueue_script( 'editor-script-block', get_theme_file_uri( '/js/editor-script-block.js' ), array(), '20181214', true );
wp_enqueue_script( 'index', get_theme_file_uri( '/js/index.js' ), array(), '20181214', true );
wp_enqueue_script( 'touchSwipe', get_theme_file_uri( '/js/jquery.touchSwipe.min.js' ), array(), '20181214', true );
wp_enqueue_script( 'touch- punch', get_theme_file_uri( '/js/jquery.ui.touch-punch.js' ), array(), '20181214', true );
wp_enqueue_script( 'jquery-latest', get_theme_file_uri( '/js/jquery-latest.min.js' ), array(), '20181214', true );
wp_enqueue_script( 'jquery-ui', get_theme_file_uri( '/js/jquery-ui-1.11.4.js' ), array(), '20181214', true );
wp_enqueue_script( 'masonry', get_theme_file_uri( '/js/masonry.pkgd.min.js' ), array(), '20181214', true );
wp_enqueue_script( 'npm', get_theme_file_uri( '/js/npm.js' ), array(), '20181214', true );
wp_enqueue_script( 'skip-link-focus-fix', get_theme_file_uri( '/js/skip-link-focus-fix.js' ), array(), '20181214', true );
wp_enqueue_script( 'store', get_theme_file_uri( '/js/store.js' ), array(), '20181214', true );
}
add_action( 'wp_enqueue_scripts', 'Twenty_twenty_scripts' );