Skip to content

Instantly share code, notes, and snippets.

@str

str/functions.php

Last active Sep 22, 2015
Embed
What would you like to do?
WP requeue JS and CSS to the bottom
<?php
/**
* The plugins load their JS in the header, which should not.
*/
function reQueuePlugins() {
if (!is_admin()) {
$jsLibs = [
'anything-popup-js' => get_option('siteurl').'/wp-content/plugins/anything-popup/anything-popup.js',
'jquery.scrollTo' => get_option('siteurl').'/wp-content/plugins/spider-faq/elements/jquery.scrollTo.js',
'loewy_blog' => get_option('siteurl').'/wp-content/plugins/spider-faq/elements/loewy_blog.js',
'tntscript1' => get_option('siteurl').'/wp-content/themes/nsm-seating/js/video-list-manager.min.js',
];
$cssLibs = [
'tablepress-responsive' => '/path/al/style.css';
];
foreach ($jsLibs as $name => $file) {
wp_deregister_script($name);
wp_register_script($name, $file, ['jquery'], false, true);
wp_enqueue_script($name);
}
foreach ($cssLibs as $name => $file) {
wp_dequeue_style($name);
wp_register_style($name, $file);
wp_enqueue_style($name);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.