Above mentioned page has some basic instructions about:
Step 2: Load the files on pages which contain contact forms
As this suggests the use of an own template file, here is a much easier way:
1. Do “Step 1” of above instruction.
2. Then instead of “Step 2”, add this to your header.php
before wp_head()
call:
if ( is_singular() && get_post_meta( $post->ID, 'contact-form-7', true ) != '' ) {
if ( function_exists( 'wpcf7_enqueue_scripts' ) ) {
wpcf7_enqueue_scripts();
wpcf7_enqueue_styles();
}
}
3. In pages/posts which have Contact Form 7 content, these where you copied [contact-form-7 id="123" title="Whatever"]
to, add a WordPress Custom Field with Name contact-form-7
and set the Value to any value you like, e.g. include
.
The css/scripts of Contact Form 7 will then be included only on pages/posts which have that custom field contact-form-7
set.
@plugin author: Feel free to add this possible solution to your instruction page.