Conversation
supportI would like to propose deferring the loading of the compset.js to the footer if that’s possible? wp_enqueue_script(‘dfrcs_compsets’, DFRCS_URL . ‘js/compsets.js’, array(‘jquery’), DFRCS_VERSION, true); It’s single line change in actions.php, this would help with performance and is a best practice for loading javascript. If moving to the footer is not possible, perhaps deferring the javascript instead?
Or if it’s not for everyone having it as an option in the CMS
Hi You can add the following code to a custom plugin to load the compsets.js file either in the footer or use defer (or both… it’s up to you). add_action( 'wp_enqueue_scripts', 'modify_dfrcs_compsets_script', 10000000 ); // Priority must be higher than the original enqueue function. function modify_dfrcs_compsets_script() { // Dequeue the original script wp_dequeue_script( 'dfrcs_compsets' ); // Re-enqueue the script in the footer wp_enqueue_script( 'dfrcs_compsets', DFRCS_URL . 'js/compsets.js', array( 'jquery' ), DFRCS_VERSION, true // Set to true to load in the footer ); } Here’s how to add a custom plugin to your site: https://datafeedrapi.helpscoutdocs.com/article/32-creating-your-own-custom-plugin Hope this helps!
Or if it’s not for everyone having it as an option in the CMS
Hi You can add the following code to a custom plugin to load the compsets.js file either in the footer or use defer (or both… it’s up to you). add_action( 'wp_enqueue_scripts', 'modify_dfrcs_compsets_script', 10000000 ); // Priority must be higher than the original enqueue function. function modify_dfrcs_compsets_script() { // Dequeue the original script wp_dequeue_script( 'dfrcs_compsets' ); // Re-enqueue the script in the footer wp_enqueue_script( 'dfrcs_compsets', DFRCS_URL . 'js/compsets.js', array( 'jquery' ), DFRCS_VERSION, true // Set to true to load in the footer ); } Here’s how to add a custom plugin to your site: https://datafeedrapi.helpscoutdocs.com/article/32-creating-your-own-custom-plugin Hope this helps!