WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Contact Form 7] Proper JavaScript Embedding Patch (2 posts)

  1. yuletide
    Member
    Posted 4 years ago #

    Here are the diffs for the necessary modification to allow the contact form 7 scripts to be relocated by other plugins (such as footer-js) or whatever. In other words, the proper way to embed JavaScript from a plugin... Especially since this script depends on JQuery!

    Index: /contact-form-7/wp-contact-form-7.php
    ===================================================================
    --- /plugins/contact-form-7/wp-contact-form-7.php	(revision 117548)
    +++ /plugins/contact-form-7/wp-contact-form-7.php	(working copy)
    @@ -693,7 +693,6 @@
     };
     //]]>
     </script>
    -<script type='text/javascript' src='<?php echo $javascript_url; ?>'></script>
     <?php
     		}
     	}
    @@ -1179,8 +1178,9 @@
     		}
    
     		$javascript_url = WPCF7_PLUGIN_URL . '/contact-form-7.js';
    +		wp_enqueue_script('wp-contact-form-7',$javascript_url,array('jquery'));
     ?>
    -<script type='text/javascript' src='<?php echo $javascript_url; ?>'></script>
    +
     <?php
     	}

    http://wordpress.org/extend/plugins/contact-form-7/

  2. Takayuki Miyoshi
    Member
    Posted 4 years ago #

    Thanks. It will be supported in the next release.

Topic Closed

This topic has been closed to new replies.

About this Topic