Performance: Loads CSS/JS whenever needs or not
-
Hello,
Contact-form-7 offer ability to manage the loading CSS/JS only where contact form presented, but “Multi Step for Contact Form 7” plugin unfortunately ignore this functionality. So, As result, for example, my site use CF7 on only 10 pages from 120 and Multi Steps on only 2 pages , but it’s js/css loads everywhere.
If you would change lines
add_action( ‘wp_enqueue_scripts’, cf7mls_frontend_scripts_callback ) );
add_action( ‘wp_enqueue_scripts’, ‘cf7mls_css_to_wp_head’ );
to
add_action( ‘wpcf7_enqueue_scripts’, cf7mls_frontend_scripts_callback ) );
add_action( ‘wpcf7_enqueue_scripts’, ‘cf7mls_css_to_wp_head’ );in file inc/frontend/init.php it resolved the problem, but not completely because not all forms use multisteps. It world be better for site performance if plugin enqueued scripts and styles when it loads, say, in cf7mls_multistep_shortcode_callback().
Since WordPress 3.3 plugin can enqueued scripts and styles everywhere and if in_footer=false it happens immediately.
Please!
- The topic ‘Performance: Loads CSS/JS whenever needs or not’ is closed to new replies.