<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Optimize and style Contact Form 7 for WordPress</title>
	<atom:link href="http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/</link>
	<description>Having fun with coding</description>
	<lastBuildDate>Sat, 17 Apr 2010 18:58:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joan</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-4431</link>
		<dc:creator>Joan</dc:creator>
		<pubDate>Sat, 17 Apr 2010 18:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-4431</guid>
		<description>Very kind of you

At the moment I&#039;ve CF7 installed locally.
In the web server still own cforms (deactivated), and now I&#039;m experiencing with &#039;Fast and Secure Contact Form&#039;, but I prefer CF7, with better performance, but want less use of ressources.
I think is basic that plugin creators think about ressources consumption, because WP itself alone eats a lot of them.
It&#039;s also basic that plugins delete all their garbage from database upon uninstalling, a very common problem (and it&#039;s a good matter for a post, if someone finds a general method).

P.S. In my previous comment, &#039;and suspect still loads in all the web pages&#039; means &#039;and suspect scripts still loads in all the web pages&#039;.

Thanks again
Joan</description>
		<content:encoded><![CDATA[<p>Very kind of you</p>
<p>At the moment I&#8217;ve CF7 installed locally.<br />
In the web server still own cforms (deactivated), and now I&#8217;m experiencing with &#8216;Fast and Secure Contact Form&#8217;, but I prefer CF7, with better performance, but want less use of ressources.<br />
I think is basic that plugin creators think about ressources consumption, because WP itself alone eats a lot of them.<br />
It&#8217;s also basic that plugins delete all their garbage from database upon uninstalling, a very common problem (and it&#8217;s a good matter for a post, if someone finds a general method).</p>
<p>P.S. In my previous comment, &#8216;and suspect still loads in all the web pages&#8217; means &#8216;and suspect scripts still loads in all the web pages&#8217;.</p>
<p>Thanks again<br />
Joan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johan</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-4401</link>
		<dc:creator>Johan</dc:creator>
		<pubDate>Wed, 14 Apr 2010 22:27:32 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-4401</guid>
		<description>Hello Joan,

Yes correct, some things have changed again in CF7 v2.2, so the code above doesn&#039;t work anymore right away. A few lines needs to be updated for it to work with v2.2. I&#039;ll try to update the article soon with a version that works for the latest CF7.

Cheers,
Johan</description>
		<content:encoded><![CDATA[<p>Hello Joan,</p>
<p>Yes correct, some things have changed again in CF7 v2.2, so the code above doesn&#8217;t work anymore right away. A few lines needs to be updated for it to work with v2.2. I&#8217;ll try to update the article soon with a version that works for the latest CF7.</p>
<p>Cheers,<br />
Johan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joan</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-4400</link>
		<dc:creator>Joan</dc:creator>
		<pubDate>Wed, 14 Apr 2010 22:15:13 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-4400</guid>
		<description>Sorry for my bad english.

This solution seems not to work for me.
I&#039;ve updated that with your advice for CF7 version 2.x (mine is 2.2)
My wordpress theme is a magazine-style with a mootols/jquery gallery in the home page, theme created by JBJ (from catswhocode.com). I have no conflicts between mootools libraries and other jquery libraries.

One proof that it works or not, I think, is to remove or change the &#039;contact&#039;, or whichever it&#039;s the name of the page where one has inserted the form. But making like that, the form loads equally!! So, I think, this solution don&#039;t work, at least for me, and I&#039;m sure styles still loads everywhere, and suspect still loads in all the web pages. Have you experimented with this? Or, what type of proof are you using?

Second question.
I have other two forms, not in pages but in posts inside their respective categories (this is motivated by the structure of the nav bar: I cannot put a page under a category). Is your code also useful for post&#039;s forms, or must change code like &#039;is_page&#039; for another expression?

P.S. In clickonf5.org there is a similar solution, using $_SERVER[&#039;REQUEST_URI&#039;], but didn&#039;t work either.

Thanks in advance for you attention

Joan</description>
		<content:encoded><![CDATA[<p>Sorry for my bad english.</p>
<p>This solution seems not to work for me.<br />
I&#8217;ve updated that with your advice for CF7 version 2.x (mine is 2.2)<br />
My wordpress theme is a magazine-style with a mootols/jquery gallery in the home page, theme created by JBJ (from catswhocode.com). I have no conflicts between mootools libraries and other jquery libraries.</p>
<p>One proof that it works or not, I think, is to remove or change the &#8216;contact&#8217;, or whichever it&#8217;s the name of the page where one has inserted the form. But making like that, the form loads equally!! So, I think, this solution don&#8217;t work, at least for me, and I&#8217;m sure styles still loads everywhere, and suspect still loads in all the web pages. Have you experimented with this? Or, what type of proof are you using?</p>
<p>Second question.<br />
I have other two forms, not in pages but in posts inside their respective categories (this is motivated by the structure of the nav bar: I cannot put a page under a category). Is your code also useful for post&#8217;s forms, or must change code like &#8216;is_page&#8217; for another expression?</p>
<p>P.S. In clickonf5.org there is a similar solution, using $_SERVER['REQUEST_URI'], but didn&#8217;t work either.</p>
<p>Thanks in advance for you attention</p>
<p>Joan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brent</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-4149</link>
		<dc:creator>Brent</dc:creator>
		<pubDate>Tue, 16 Mar 2010 16:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-4149</guid>
		<description>Thank you for this post.  I was directed to this post from the Word Press forums. My issue was that I had purchased a pre-built template with a fun JavaScript interactive element on the home page. It seems that both home page element and Contact Form 7 are using the same Jquery library. This tidbit allowed me to disable the Contact Form 7 javascript on the home page(where I didn&#039;t need it anyways) so that the home page element works again. 

Great tip! 
Thank you again. 
-Brent</description>
		<content:encoded><![CDATA[<p>Thank you for this post.  I was directed to this post from the Word Press forums. My issue was that I had purchased a pre-built template with a fun JavaScript interactive element on the home page. It seems that both home page element and Contact Form 7 are using the same Jquery library. This tidbit allowed me to disable the Contact Form 7 javascript on the home page(where I didn&#8217;t need it anyways) so that the home page element works again. </p>
<p>Great tip!<br />
Thank you again.<br />
-Brent</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-4051</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 05 Mar 2010 20:33:33 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-4051</guid>
		<description>Thank you so much for this.</description>
		<content:encoded><![CDATA[<p>Thank you so much for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Christophe</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-3943</link>
		<dc:creator>Christophe</dc:creator>
		<pubDate>Fri, 26 Feb 2010 12:58:10 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-3943</guid>
		<description>Wonderful... Couldn&#039;t solve this problem for 2 days!
Thanks a lot ;)</description>
		<content:encoded><![CDATA[<p>Wonderful&#8230; Couldn&#8217;t solve this problem for 2 days!<br />
Thanks a lot ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-2075</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Mon, 02 Nov 2009 15:28:07 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-2075</guid>
		<description>Dude, this shows the solution (simple).

http://www.grapethinking.com/wordpress-contact-form-7-plugin-landing-pag</description>
		<content:encoded><![CDATA[<p>Dude, this shows the solution (simple).</p>
<p><a href="http://www.grapethinking.com/wordpress-contact-form-7-plugin-landing-pag" rel="nofollow">http://www.grapethinking.com/wordpress-contact-form-7-plugin-landing-pag</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johan</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-1394</link>
		<dc:creator>Johan</dc:creator>
		<pubDate>Fri, 02 Oct 2009 00:57:35 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-1394</guid>
		<description>Awesome!
I was just about to check out the thematic theme, but I&#039;m happy to see you got it sorted out anyway! Excellent! :)

Johan</description>
		<content:encoded><![CDATA[<p>Awesome!<br />
I was just about to check out the thematic theme, but I&#8217;m happy to see you got it sorted out anyway! Excellent! :)</p>
<p>Johan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-1392</link>
		<dc:creator>Pat</dc:creator>
		<pubDate>Fri, 02 Oct 2009 00:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-1392</guid>
		<description>Ah! I found the solution:

Quote: In the event a child theme is being used, the parent theme directory URI will be returned, not the child theme directory URI (use  get_stylesheet_directory_uri() instead) 

ref.: http://codex.wordpress.org/Function_Reference/get_template_directory_uri

So, if you use a child theme, like I do, the code is this:

&lt;code&gt;
// Change the URL to the ajax-loader image
function change_wpcf7_ajax_loader($content) {
	if ( is_page(&#039;contact&#039;) ) {
		$string = $content;
		$pattern = &#039;/()/i&#039;;
		$replacement = &quot;$1&quot;. get_stylesheet_directory_uri().&quot;/images/ajax-loader.gif$3&quot;;
		$content =  preg_replace($pattern, $replacement, $string);
	}
	return $content;
}
add_filter( &#039;the_content&#039;, &#039;change_wpcf7_ajax_loader&#039;, 100 );
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>Ah! I found the solution:</p>
<p>Quote: In the event a child theme is being used, the parent theme directory URI will be returned, not the child theme directory URI (use  get_stylesheet_directory_uri() instead) </p>
<p>ref.: <a href="http://codex.wordpress.org/Function_Reference/get_template_directory_uri" rel="nofollow">http://codex.wordpress.org/Function_Reference/get_template_directory_uri</a></p>
<p>So, if you use a child theme, like I do, the code is this:</p>
<p><code><br />
// Change the URL to the ajax-loader image<br />
function change_wpcf7_ajax_loader($content) {<br />
	if ( is_page('contact') ) {<br />
		$string = $content;<br />
		$pattern = '/()/i';<br />
		$replacement = "$1". get_stylesheet_directory_uri()."/images/ajax-loader.gif$3";<br />
		$content =  preg_replace($pattern, $replacement, $string);<br />
	}<br />
	return $content;<br />
}<br />
add_filter( 'the_content', 'change_wpcf7_ajax_loader', 100 );<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pat</title>
		<link>http://coding.cglounge.com/2009/06/optimize-style-contact-form-7-wordpress/#comment-1391</link>
		<dc:creator>Pat</dc:creator>
		<pubDate>Fri, 02 Oct 2009 00:44:53 +0000</pubDate>
		<guid isPermaLink="false">http://coding.cglounge.com/?p=244#comment-1391</guid>
		<description>Thank you Johan for your reply.

Regarding the Ajax loader image, in my case, it does&#039;t work. The path refers to the Thematic image folder instead of my child theme:
 :-(

Now, for the stylesheet and the javascripts, I followed Justin Tadlock&#039;s suggestions, and came up with this code:

`
/*
 * Functions:	Optimize Contact Form 7
 *
 */

function deregister_cf7_js() {
   if ( !is_page(&#039;contact&#039;) ) {
	wp_deregister_script( &#039;contact-form-7&#039; );
     }
}
add_action( &#039;wp_print_scripts&#039;, &#039;deregister_cf7_js&#039;, 100 );



function deregister_ct7_styles() {
	wp_deregister_style( &#039;contact-form-7&#039; );
}
add_action( &#039;wp_print_styles&#039;, &#039;deregister_ct7_styles&#039;, 100 );
`
ref.: http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles

Thanks for your help.

Now I need to figure out how to point to my child theme.

Pat</description>
		<content:encoded><![CDATA[<p>Thank you Johan for your reply.</p>
<p>Regarding the Ajax loader image, in my case, it does&#8217;t work. The path refers to the Thematic image folder instead of my child theme:<br />
 :-(</p>
<p>Now, for the stylesheet and the javascripts, I followed Justin Tadlock&#8217;s suggestions, and came up with this code:</p>
<p>`<br />
/*<br />
 * Functions:	Optimize Contact Form 7<br />
 *<br />
 */</p>
<p>function deregister_cf7_js() {<br />
   if ( !is_page(&#8216;contact&#8217;) ) {<br />
	wp_deregister_script( &#8216;contact-form-7&#8242; );<br />
     }<br />
}<br />
add_action( &#8216;wp_print_scripts&#8217;, &#8216;deregister_cf7_js&#8217;, 100 );</p>
<p>function deregister_ct7_styles() {<br />
	wp_deregister_style( &#8216;contact-form-7&#8242; );<br />
}<br />
add_action( &#8216;wp_print_styles&#8217;, &#8216;deregister_ct7_styles&#8217;, 100 );<br />
`<br />
ref.: <a href="http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles" rel="nofollow">http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles</a></p>
<p>Thanks for your help.</p>
<p>Now I need to figure out how to point to my child theme.</p>
<p>Pat</p>
]]></content:encoded>
	</item>
</channel>
</rss>
