Skip Navigation

[Geschlossen] Don't include CSS / JS in frontend that is not needed

This support ticket is created vor 8 Jahre, 5 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 2 Antworten, has 2 Stimmen.

Last updated by Adriano vor 8 Jahre, 5 Monate.

Assigned support staff: Adriano.

Author
Artikel
#235554

Hi,

I have looked at the source code of a almost finished website I have built with TVC-toolset, and I noticed some CSS and JS is included of the Views plugin.

In this topic: https://toolset.com/forums/topic/remove-unneccessary-css-files/, I found this to paste in my functions.php file, I understand this 100%:

// dequeue wp-types front-end scripts and stylesheets
add_action('wp_enqueue_scripts', 'prefix_remove_views_assets', 20);
   
function prefix_remove_views_assets() {
   
    // Scripts
       
    // views_front_end_utils.js - 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 - 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' );
   
}

QS 1) When I look at the files mentioned above, and looking them up in the source of my website (frontend), then I can't find:

- views_front_end_utils.js
- wpv-date-front-end-control.js
- wpv-views-sorting.css

Why are those not included in my website?

QS 2) The purpose of using the code above, is ofcourse to get rid of CSS and JS files inserted by Views that are not used at my website. It this topic: https://toolset.com/forums/topic/remove-unneccessary-css-files/, from end 2012, a feature request is made that only CSS and JS files by views are included when they are needed. What is the status of this feature request? Because it's now 2014 and we still need to use the code I included above.

Kind regards,

Willem

#235555

QS 3) I also see this in my HTML:

<script type="text/javascript">
            var front_ajaxurl = '<em><u>hidden link</u></em>';
            var wpv_calendar_image = '<em><u>hidden link</u></em>';
            var wpv_calendar_text = 'Datum selecteren';
        </script>

Can I also delete this?

#235716

Dear willem-siebeS,

The code above should remove the following files from your source code in the front-end:

wp-views/res/js/views_front_end_utils.js
wp-views/res/js/wpv-pagination-embedded.js
wp-views/res/js/jquery.ui.datepicker.min.js
wp-views/res/js/wpv-date-front-end-control.js
wp-views/res/css/wpv-views-sorting.css
wp-views/res/css/wpv-pagination.css

When exactly our developers will add a new feature or not is not up-to us to determine. Each issue reported in, whether a bug or a new feature request, is taken seriously into consideration. It is given a high or low priority based on a number of factors. Factors which those with the overview of all things related are in the best position to determine.

You could remove the code in #235555 with:

remove_action( 'wp_head', 'wpv_add_front_end_js' );

Please let me know if you are satisfied with my answer and if I can help you with any other related question.

Das Thema „[Geschlossen] Don't include CSS / JS in frontend that is not needed“ ist für neue Antworten geschlossen.