Filter by 카테고리

Remove scripts that don’t use Avada theme

()

The theme provides a class that will allow you to manually deregister scripts in a child theme or custom plugin. Here is an example that would eliminate all :

add_action( ‘wp_enqueue_scripts’, ‘custom_disable_theme_js’ );

function custom_disable_theme_js() {
Fusion_Dynamic_JS::deregister_script(‘fusion-chartjs’);
}

The theme loads in over a hundred individual scripts, and some may be required for functionality on your site where others will not be, so I found the best approach was to screen out all of the scripts and then add them back in selectively as needed. With this approach I was able to eliminate 100 JS calls and 1.2MB of unnecessary load in the case where I implemented this approach.

Here’s a full list from my initial screen:

Fusion_Dynamic_JS::deregister_script(‘avada-comments’);
Fusion_Dynamic_JS::deregister_script(‘avada-general-footer’);
Fusion_Dynamic_JS::deregister_script(‘avada-mobile-image-hover’);
Fusion_Dynamic_JS::deregister_script(‘avada-quantity’);
Fusion_Dynamic_JS::deregister_script(‘avada-scrollspy’);
Fusion_Dynamic_JS::deregister_script(‘avada-select’);
Fusion_Dynamic_JS::deregister_script(‘avada-sidebars’);
Fusion_Dynamic_JS::deregister_script(‘avada-tabs-widget’);

Fusion_Dynamic_JS::deregister_script(‘bootstrap-collapse’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-modal’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-popover’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-scrollspy’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-tab’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-tooltip’);
Fusion_Dynamic_JS::deregister_script(‘bootstrap-transition’);

Fusion_Dynamic_JS::deregister_script(‘cssua’);

Fusion_Dynamic_JS::deregister_script(‘fusion-alert’);
Fusion_Dynamic_JS::deregister_script(‘fusion-blog’);
Fusion_Dynamic_JS::deregister_script(‘fusion-button’);
Fusion_Dynamic_JS::deregister_script(‘fusion-carousel’);
Fusion_Dynamic_JS::deregister_script(‘fusion-chartjs’);
Fusion_Dynamic_JS::deregister_script(‘fusion-column-bg-image’);
Fusion_Dynamic_JS::deregister_script(‘fusion-count-down’);
Fusion_Dynamic_JS::deregister_script(‘fusion-equal-heights’);
Fusion_Dynamic_JS::deregister_script(‘fusion-flexslider’);
Fusion_Dynamic_JS::deregister_script(‘fusion-image-before-after’);
Fusion_Dynamic_JS::deregister_script(‘fusion-lightbox’);
Fusion_Dynamic_JS::deregister_script(‘fusion-parallax’);
Fusion_Dynamic_JS::deregister_script(‘fusion-popover’);
Fusion_Dynamic_JS::deregister_script(‘fusion-recent-posts’);
Fusion_Dynamic_JS::deregister_script(‘fusion-sharing-box’);
Fusion_Dynamic_JS::deregister_script(‘fusion-syntax-highlighter’);
Fusion_Dynamic_JS::deregister_script(‘fusion-testimonials’);
Fusion_Dynamic_JS::deregister_script(‘fusion-title’);
Fusion_Dynamic_JS::deregister_script(‘fusion-tooltip’);
Fusion_Dynamic_JS::deregister_script(‘fusion-video-bg’);
Fusion_Dynamic_JS::deregister_script(‘fusion-video-general’);
Fusion_Dynamic_JS::deregister_script(‘fusion-waypoints’);

Fusion_Dynamic_JS::deregister_script(‘images-loaded’);
Fusion_Dynamic_JS::deregister_script(‘isotope’);

Fusion_Dynamic_JS::deregister_script(‘jquery-appear’);
Fusion_Dynamic_JS::deregister_script(‘jquery-caroufredsel’);
Fusion_Dynamic_JS::deregister_script(‘jquery-count-down’);
Fusion_Dynamic_JS::deregister_script(‘jquery-count-to’);
Fusion_Dynamic_JS::deregister_script(‘jquery-cycle’);
Fusion_Dynamic_JS::deregister_script(‘jquery-easing’);
Fusion_Dynamic_JS::deregister_script(‘jquery-easy-pie-chart’);
Fusion_Dynamic_JS::deregister_script(‘jquery-event-move’);
Fusion_Dynamic_JS::deregister_script(‘jquery-fade’);
Fusion_Dynamic_JS::deregister_script(‘jquery-flexslider’);
Fusion_Dynamic_JS::deregister_script(‘jquery-fitvids’);
Fusion_Dynamic_JS::deregister_script(‘jquery-fusion-maps’);
Fusion_Dynamic_JS::deregister_script(‘jquery-hover-flow’);
Fusion_Dynamic_JS::deregister_script(‘jquery-hover-intent’);
Fusion_Dynamic_JS::deregister_script(‘jquery-infinite-scroll’);
Fusion_Dynamic_JS::deregister_script(‘jquery-lightbox’);
Fusion_Dynamic_JS::deregister_script(‘jquery-mousewheel’);
Fusion_Dynamic_JS::deregister_script(‘jquery-placeholder’);
Fusion_Dynamic_JS::deregister_script(‘jquery-request-animation-frame’);
Fusion_Dynamic_JS::deregister_script(‘jquery-sticky-kit’);
Fusion_Dynamic_JS::deregister_script(‘jquery-to-top’);
Fusion_Dynamic_JS::deregister_script(‘jquery-touch-swipe’);
Fusion_Dynamic_JS::deregister_script(‘jquery-waypoints’);

Fusion_Dynamic_JS::deregister_script(‘lazysizes’);
Fusion_Dynamic_JS::deregister_script(‘modernizr’);
Fusion_Dynamic_JS::deregister_script(‘packery’);
Fusion_Dynamic_JS::deregister_script(‘vimeo-player’);

The theme gets updated from time to time, so this list will likely change. You can grep for the name of the JS file that you want to deregister in the main theme folder to find out what its handle is.

이 게시물은 얼마나 유용했습니까?

별을 클릭하여 등급을 매깁니다!

평균 평점 / 5. 투표 수:

지금까지 투표가 없습니다! 이 게시물을 평가하는 첫 번째 사람이 되세요.

리플 남기기