How does Include plugin scripts and styles only for one page?
-
Can someone told what I need to write in
functions.php
that scripts and styles contact-form-7 include only in one page. Contact page for example.I tried deregistered scripts and styles of plugin.
add_action('wp_footer', function (){ wp_deregister_style('contact-form-7-css'); wp_deregister_script('contact-form-7-js-extra'); wp_deregister_script('contact-form-7-js'); if (is_page('contact')): wp_enqueue_style('contact-form-7-css', get_template_directory_uri() . '/wp-content/plugins/contact-form-7/includes/css/styles.css', '', null, false); wp_enqueue_script('contact-form-7-js', get_template_directory_uri() . '/wp-content/plugins/contact-form-7/includes/js/index.js', '', null, true); endif; });
But this is not the right approach.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘How does Include plugin scripts and styles only for one page?’ is closed to new replies.