Skip to content

Instantly share code, notes, and snippets.

@tevashov
Last active October 27, 2022 21:55
Show Gist options
  • Save tevashov/9448366 to your computer and use it in GitHub Desktop.
Save tevashov/9448366 to your computer and use it in GitHub Desktop.
Clean output buffer from NextGen Gallery crap (Roots starter theme) #WP
/**
* Подчищаем ненужные скрипты и стили
*/
function teff_de_script() {
wp_dequeue_script('photocrati_ajax');
wp_deregister_script('photocrati_ajax');
wp_dequeue_script('ngg-store-js');
wp_deregister_script('ngg-store-js');
wp_dequeue_script('nextgen_lightbox_context');
wp_deregister_script('nextgen_lightbox_context');
wp_dequeue_script('ngg_common');
wp_deregister_script('ngg_common');
wp_dequeue_script('photocrati-nextgen_basic_thumbnails');
wp_deregister_script('photocrati-nextgen_basic_thumbnails');
wp_dequeue_script('photocrati-nextgen_basic_compact_album');
wp_deregister_script('photocrati-nextgen_basic_compact_album');
wp_dequeue_script('jquery.dotdotdot');
wp_deregister_script('jquery.dotdotdot');
}
function teff_de_style() {
wp_dequeue_style('nextgen_gallery_related_images');
wp_deregister_style('nextgen_gallery_related_images');
wp_dequeue_style('fontawesome');
wp_deregister_style('fontawesome');
wp_dequeue_style('ngg_trigger_buttons');
wp_deregister_style('ngg_trigger_buttons');
wp_dequeue_style('nextgen_basic_thumbnails_style');
wp_deregister_style('nextgen_basic_thumbnails_style');
wp_dequeue_style('nextgen_pagination_style');
wp_deregister_style('nextgen_pagination_style');
wp_dequeue_style('nggallery');
wp_deregister_style('nggallery');
wp_dequeue_style('nextgen_basic_album_style');
wp_deregister_style('nextgen_basic_album_style');
}
function teff_inspect_scripts() {
global $wp_scripts;
echo "\n".'<!-- DEGLUKKER: registered scripts is ';
foreach( $wp_scripts->queue as $handle ) :
echo $handle . ' | ';
endforeach;
echo ' -->'."\n";
}
function teff_inspect_styles() {
global $wp_styles;
echo "\n".'<!-- DEGLUKKER: registered styles is ';
foreach( $wp_styles->queue as $handle ) :
echo $handle . ' | ';
endforeach;
echo ' -->'."\n";
}
add_action( 'wp_print_scripts', 'teff_de_script', 1000 );
add_action( 'wp_print_styles', 'teff_de_style', 1000 );
if (DEGLUKKER) add_action( 'wp_print_scripts', 'teff_inspect_scripts', 1001 );
if (DEGLUKKER) add_action( 'wp_print_styles', 'teff_inspect_styles',1001 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment