Last active
August 29, 2015 14:05
-
-
Save Willem-Siebe/9520464d0b6b763bf1de to your computer and use it in GitHub Desktop.
Remove CSS and JS from Views plugin, only when it's not needed! See http://wp-types.com/forums/topic/dont-include-css-js-in-frontend-that-is-not-needed/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove CSS and JS from Views plugin, only when it's not needed! See https://gist.github.com/Willem-Siebe/9520464d0b6b763bf1de. | |
add_action('wp_enqueue_scripts', 'wsis_prefix_remove_views_assets', 20); | |
function wsis_prefix_remove_views_assets() { | |
// Scripts | |
// views_front_end_utils.js (not used anymore from -for sure- version 1.6.4) | |
// used in Views parametric searches | |
wp_deregister_script( 'wpv-front-end-utils' ); | |
// wpv-pagination-embedded.js | |
// used in Views pagination and table sorting | |
wp_deregister_script( 'views-pagination-script' ); | |
// jquery.ui.datepicker.min.js and | |
// wpv-date-front-end-control.js ((not used anymore from -for sure- version 1.6.4) | |
// used in Views parametric searches by a date field | |
wp_deregister_script( 'jquery-ui-datepicker' ); | |
wp_deregister_script( 'wpv-date-front-end-script' ); | |
// Styles | |
// wpv-views-sorting.css | |
// used in Views table sorting | |
wp_deregister_style( 'views-table-sorting-style' ); | |
// wpv-pagination.css | |
// used in Views pagination | |
wp_deregister_style( 'views-pagination-style' ); | |
} |
Update: zie https://wp-types.com/forums/topic/follow-up-2-dont-include-css-js-in-frontend-that-is-not-needed/. Frontend styles and JS included in this file \wp-views\embedded\inc\wpv.class.php
. Look for function wpv_frontend_enqueue_scripts
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some of the files are not used anymore from (for sure) version 1.6.4 of WP Views, see https://wp-types.com/forums/topic/follow-up-dont-include-css-js-in-frontend-that-is-not-needed/.