<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mister Piercy</title>
	<atom:link href="http://misterpiercy.com/feed" rel="self" type="application/rss+xml" />
	<link>http://misterpiercy.com</link>
	<description></description>
	<lastBuildDate>Fri, 22 Mar 2013 02:47:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>FIX: Responsive Viewports on Mobile Devices</title>
		<link>http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices</link>
		<comments>http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices#comments</comments>
		<pubDate>Fri, 08 Mar 2013 01:51:30 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[Responsive Design]]></category>
		<category><![CDATA[Mobile Design]]></category>
		<category><![CDATA[Quick Fix]]></category>

		<guid isPermaLink="false">http://misterpiercy.com/?p=310</guid>
		<description><![CDATA[<p>This is a super-quickie &#8212; when you&#8217;re developing a responsive site and your test-devices don&#8217;t seem to recognize the actual viewport dimensions (say, 768 x 1024) &#8212; the culprit is often a single &#60;meta&#62; statement: I&#8217;ve run into this problem before and conveniently forgot all about it in the meantime. While testing changes to this [...]</p><p>The post <a href="http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices">FIX: Responsive Viewports on Mobile Devices</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></description>
				<content:encoded><![CDATA[<div><a href="http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices"><img class="size-full wp-image-372 aligncenter" title="768 != 768" alt="768 != 768" src="http://misterpiercy.com/wp-content/uploads/2013/03/768x768.png" width="500" height="191" /></a></div>
<p>This is a super-quickie &#8212; when you&#8217;re developing a responsive site and your test-devices don&#8217;t seem to recognize the actual viewport dimensions (say, 768 x 1024) &#8212; the culprit is often a single <strong>&lt;meta&gt;</strong> statement:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot; /&gt;
</pre>
<p><span id="more-310"></span></p>
<p>I&#8217;ve run into this problem before and conveniently forgot all about it in the meantime. While testing changes to this site&#8217;s theme I found that on the iPad the screen width was always 768 pixels, regardless of the device orientation. Adding this <strong>&lt;meta&gt;</strong> statement solved the problem.</p>
<p>Thanks to <a title="Where I found the answer THIS time..." href="http://alwaystwisted.com/post.php?s=2013-01-10-dont-do-this-in-responsive-web-development">alwaystwisted.com</a> for the updated reminder &#8212; don&#8217;t dick around with the <a title="Viewport guidelines ala Mozilla" href="https://developer.mozilla.org/en-US/docs/Mobile/Viewport_meta_tag"><strong>minimum</strong> or <strong>maximum</strong> settings</a> unless you want to mess around with users&#8217; ability to zoom on touchy-touchy devices.</p>
<p>The post <a href="http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices">FIX: Responsive Viewports on Mobile Devices</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://misterpiercy.com/responsive-design/fix-responsive-viewports-on-mobile-devices/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Styling WordPress Search Forms with Bootstrap Icons</title>
		<link>http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons</link>
		<comments>http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons#comments</comments>
		<pubDate>Mon, 04 Mar 2013 22:50:24 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Quick Fix]]></category>
		<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://misterpiercy.com/?p=233</guid>
		<description><![CDATA[<p>I&#8217;m still in the process of scratch-building a responsive WordPress theme with Bootstrap and today decided to tackle the search widget styling. Well, to be completely honest I&#8217;m not quite scratch-building it &#8212; I&#8217;m adapting Automattic&#8217;s Toolbox theme, but I&#8217;m hand-rolling most of the responsive features. If you&#8217;re not using Bootstrap, the process of styling [...]</p><p>The post <a href="http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons">Styling WordPress Search Forms with Bootstrap Icons</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons"><img class="alignnone size-full wp-image-252" title="Bootstrap Icons" alt="Bootstrap Icons Image" src="http://misterpiercy.com/wp-content/uploads/2013/03/bootstrap_icons.png" width="800" height="188" /></a></p>
<p>I&#8217;m still in the process of scratch-building a responsive WordPress theme with <a title="Bootstrap" href="http://twitter.github.com/bootstrap/">Bootstrap</a> and today decided to tackle the search widget styling. Well, to be completely honest I&#8217;m <em>not quite</em> scratch-building it &#8212; I&#8217;m adapting <a title="Toolbox from Automattic" href="http://wordpress.org/extend/themes/toolbox">Automattic&#8217;s Toolbox</a> theme, but I&#8217;m hand-rolling most of the responsive features.</p>
<p>If you&#8217;re not using Bootstrap, the process of styling the search widget is pretty straightforward &#8212; just modify (or define) the relevant CSS classes and you&#8217;re good to go. In order to use Bootstrap icons, however, it helps to restructure the the form input element. Since <a title="Bootstrap Icons" href="http://twitter.github.com/bootstrap/base-css.html#icons">Bootstraps&#8217; icons</a> (from <a title="Glyphicons" href="http://glyphicons.com/">Glyphicons</a>) are all stored in single sprite you can&#8217;t link directly to an individual icon in order to set it as a CSS element&#8217;s background property. Instead you specify the icon by CSS class name, which positions the element&#8217;s viewport over the selected part of the sprite.</p>
<p><span id="more-233"></span></p>
<p>For example, the HTML code</p>
<pre class="brush: xml; title: ; notranslate">&lt;i class=&quot;icon-search&quot;&gt; &lt;/i&gt;</pre>
<p>invokes this CSS:</p>
<pre class="brush: css; title: ; notranslate">.icon-search {
  background-position: -48px 0;
}</pre>
<p>The default search form input type won&#8217;t work with Bootstraps&#8217; icon syntax, so it helps to change the input type to a button. Rather than fiddle around with the WordPress internals and modify the default search widget I found a more elegant solution by looking at the <a title="get_search_form()" href="http://codex.wordpress.org/Function_Reference/get_search_form">WordPress codex entry</a> for the function, which calls the  <strong>get_search_form()</strong> widget. It turns out that the function attempts to load the file <strong>searchform.php</strong>, but if the file doesn&#8217;t exist it loads the default form widget. I created the file with the following contents, modified from the example in the codex entry:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form action=&quot;/&quot; method=&quot;get&quot;&gt;
&lt;fieldset&gt;&lt;input id=&quot;search&quot; type=&quot;text&quot; name=&quot;s&quot; value=&quot;&lt;?php the_search_query(); ?&gt;&quot; /&gt;
 &lt;button class=&quot;btn&quot; type=&quot;submit&quot;&gt;
 &lt;i class=&quot;icon-search&quot;&gt; &lt;/i&gt;
 &lt;/button&gt;&lt;/fieldset&gt;
&lt;/form&gt;
</pre>
<p>And that&#8217;s all there is to it! Note the <strong>btn</strong> class on the button element&#8211; it&#8217;s another snazzy little bit of kit from Bootstrap which handles the size of the input element and its contents based on the form context. Neat! Just in case you&#8217;re not reading this post on <a title="Mister Piercy" href="http://misterpiercy.com">my site</a> (shame on you), here&#8217;s what the search form looks like with default, out-of-the-box Bootstrap styling:</p>
<p style="text-align: center;"><img class="size-full wp-image-262 aligncenter" title="Search Form" alt="search_form" src="http://misterpiercy.com/wp-content/uploads/2013/03/search_form.png" width="213" height="45" /></p>
<p>The post <a href="http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons">Styling WordPress Search Forms with Bootstrap Icons</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://misterpiercy.com/wordpress/styling-wordpress-search-forms-with-bootstrap-icons/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing a Bootstrap Installation on WordPress</title>
		<link>http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress</link>
		<comments>http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress#comments</comments>
		<pubDate>Wed, 30 Jan 2013 14:45:49 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Quick Fix]]></category>
		<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://misterpiercy.com/?p=162</guid>
		<description><![CDATA[<p>The Bootstrap front-end framework is pretty cool and extremely easy to use, but it&#8217;s not always obvious that everything is working properly after installation. You&#8217;ll see the new style sheets right away, but testing the Javascript takes a little bit of extra effort. Here&#8217;s an overview of the process: Download and install the Bootstrap framework [...]</p><p>The post <a href="http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress">Testing a Bootstrap Installation on WordPress</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></description>
				<content:encoded><![CDATA[<p><a href="http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress"><img class="alignnone size-full wp-image-289" alt="bootstrap" src="http://misterpiercy.com/wp-content/uploads/2013/01/bootstrap.png" width="800" height="90" /></a></p>
<p>The <a title="Bootstrap on GitHub" href="http://twitter.github.com/bootstrap/index.html">Bootstrap</a> front-end framework is pretty cool and extremely easy to use, but it&#8217;s not always obvious that everything is working properly after installation. You&#8217;ll see the new style sheets right away, but testing the Javascript takes a little bit of extra effort.</p>
<p>Here&#8217;s an overview of the process:</p>
<ol>
<li>Download and install the Bootstrap framework</li>
<li>Modify <strong></strong><strong>functions.php</strong> and <strong>header.php</strong> to load and Javascript and stylesheets</li>
<li>Test Javascript with a Bootstrap-specific feature</li>
</ol>
<p><span id="more-162"></span></p>
<p>Downloading and installing Bootstrap is a breeze. <a title="Bootstrap on GitHub" href="http://twitter.github.com/bootstrap/index.html">Grab the project from GitHub</a>, extract it, then upload it to your WordPress theme. I installed the Bootstrap directories (<strong>css/</strong>, <strong>img/</strong>, <strong>js/</strong>) in my theme&#8217;s root directory &#8212; <strong>/wp-content/themes/my_theme/</strong>.</p>
<p><span style="color: #993300;"><strong>Please note</strong></span> that I am creating a new WordPress theme based on the <a title="Toolbox theme from Automattic" href="http://wordpress.org/extend/themes/toolbox">Toolbox</a> theme from <a title="Planet Mullenweg" href="http://automattic.com/">Automattic</a> and therefore some things are missing from my theme which might be present (and look a little different) in yours. For example, your theme likely already loads jQuery and has one or more scripts registered and enqueued in your theme&#8217;s <strong>functions.php</strong>. Mine did not, which is why I&#8217;m using the custom function in the following example. Also, I&#8217;m using <a title="jQuery from Google CDN and local backup" href="http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress">a different method to call jQuery</a>, which blends Google CDN and local sources. Please adapt the example as necessary.</p>
<p>Next, edit your theme&#8217;s <strong>functions.php</strong> file to register the Bootstrap Javascript and jQuery (if necessary). I&#8217;m using the minified version of the Bootstrap code to save on loading time. My minimal theme uses the following custom script to register the resources:</p>
<pre class="brush: php; title: ; notranslate">//Register Javascript...
function load_javascript() {
	wp_register_script('jQuery', get_template_directory_uri().'/js/jquery.js');
	wp_register_script('bootstrapMin', get_template_directory_uri().'/js/bootstrap.min.js');
	//wp_enqueue_script('jQuery');
	wp_enqueue_script('bootstrapMin');
}
add_action('init', 'load_javascript');</pre>
<p>Once the changes are complete in <strong>functions.php</strong>, add the necessary links in <strong>header.php</strong>. Note that I&#8217;m not enqueuing jQuery in <strong>functions.php</strong> &#8212; the conditional test in the header decides which source it loads from.</p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js&quot;&gt;&lt;/script&gt;&lt;script type=&quot;text/javascript&quot;&gt;
if (typeof jQuery == 'undefined') {
		document.write(&lt;?php wp_enqueue_script('jQuery'); ?&gt;);
	}
&lt;/script&gt;
 	&lt;link href=&quot;&lt;?php echo get_template_directory_uri().'/css/bootstrap.min.css'; ?&gt;&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;
 	&lt;link href=&quot;&lt;?php echo get_template_directory_uri().'/css/bootstrap-responsive.min.css'; ?&gt;&quot; rel=&quot;stylesheet&quot; media=&quot;screen&quot; /&gt;</pre>
<p>Finally, we should test the installation by inserting some code to call a Bootstrap-specific function. I chose this <a title="Bootstrap modal example" href="http://twitter.github.com/bootstrap/javascript.html#modals">modal example from the Bootstrap documentation</a>, which I added right after the opening &lt;BODY&gt; tag in <strong>header.php</strong>. When you refresh the page the modal link should appear in the upper left-hand corner and should work similarly to the documentation example. The styling might not be identical, thanks to style collisions between the Bootstrap CSS and other, non-Bootstrap CSS.</p>
<pre class="brush: xml; title: ; notranslate">&lt;!-- Button to trigger modal --&gt;
&lt;a class=&quot;btn&quot; role=&quot;button&quot; href=&quot;#myModal&quot; data-toggle=&quot;modal&quot;&gt;Launch demo modal&lt;/a&gt;

&lt;!-- Modal --&gt;
&lt;div class=&quot;modal hide fade&quot; id=&quot;myModal&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot;&gt;
&lt;div class=&quot;modal-header&quot;&gt;
&lt;button class=&quot;close&quot; type=&quot;button&quot; data-dismiss=&quot;modal&quot;&gt;×&lt;/button&gt;
&lt;h3 id=&quot;myModalLabel&quot;&gt;Modal header&lt;/h3&gt;
&lt;/div&gt;
&lt;div class=&quot;modal-body&quot;&gt;One fine body…&lt;/div&gt;
&lt;div class=&quot;modal-footer&quot;&gt;&lt;button class=&quot;btn&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;
 &lt;button class=&quot;btn btn-primary&quot;&gt;Save changes&lt;/button&gt;&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>As always, please leave a comment if I&#8217;ve made any egregious mistakes and I&#8217;ll fix them right away.</p>
<p>The post <a href="http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress">Testing a Bootstrap Installation on WordPress</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://misterpiercy.com/wordpress/testing-bootstrap-installation-on-wordpress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Loading jQuery from Google CDN with a Local Backup on WordPress</title>
		<link>http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress</link>
		<comments>http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress#comments</comments>
		<pubDate>Wed, 23 Jan 2013 22:13:57 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Quick Fix]]></category>
		<category><![CDATA[WordPress Themes]]></category>

		<guid isPermaLink="false">http://misterpiercy.com/?p=50</guid>
		<description><![CDATA[<p>Here&#8217;s a quick fix for WordPress theme developers who want jQuery delivered from Google&#8217;s CDN whenever possible, but also want a local copy to fall back on if the CND isn&#8217;t available. I&#8217;ve also included a couple of extra lines of code you can use to test your configuration. Since I&#8217;m developing a custom theme [...]</p><p>The post <a href="http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress">Loading jQuery from Google CDN with a Local Backup on WordPress</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress"><img class="size-full wp-image-276 aligncenter" title="Google CDN + jQuery" alt="Google CDN + jQuery image" src="http://misterpiercy.com/wp-content/uploads/2013/01/google_jquery.png" width="485" height="61" /></a></p>
<p>Here&#8217;s a quick fix for WordPress theme developers who want jQuery delivered from Google&#8217;s CDN whenever possible, but also want a local copy to fall back on if the CND isn&#8217;t available. I&#8217;ve also included a couple of extra lines of code you can use to test your configuration.</p>
<p><span id="more-50"></span></p>
<p>Since I&#8217;m developing a custom theme based on a bare-bones starter theme (<a title="Toolbox Theme for WordPress" href="http://wordpress.org/extend/themes/toolbox">Toolbox</a> from <a title="Planet Mullenweg" href="http://automattic.com/">Automattic</a>), I didn&#8217;t have a local copy of jQuery. I downloaded the <a title="jQuery via Google CDN" href="https://developers.google.com/speed/libraries/devguide#jquery">current version</a> and installed it as <strong>/wp-content/themes/my_theme/js/jquery.js</strong>. If you already have an installed copy of jQuery that you&#8217;d rather use, substitute the appropriate path where necessary.</p>
<p>Next, register jQuery in <strong>functions.php</strong>.  If you&#8217;re not building your own theme, jQuery is probably already registered. Here&#8217;s what to add to your <strong>functions.php</strong> if it isn&#8217;t:</p>
<pre class="brush: php; title: ; notranslate">function load_javascript() {
 wp_register_script('jQuery', get_template_directory_uri().'/js/jquery.js');
 }
 add_action('init', 'load_javascript');</pre>
<p>By the way &#8212; if you&#8217;re developing a theme from scratch, keep this function in mind for registering future Javascript code.</p>
<p>Also, note that wp_enqueue_script() <em><strong>is not</strong></em> being called at this point. It will be called from the page header within a conditional statement. Non-theme developers can comment this equivalent line out in <strong>functions.php</strong>:</p>
<pre class="brush: php; title: ; notranslate">function load_javascript() {
 wp_register_script('jQuery', get_template_directory_uri().'/js/jquery.js');
 //wp_enqueue_script('jQuery');
 }
 add_action('init', 'load_javascript');</pre>
<p>Add the following to <strong>header.php</strong> somewhere before the &lt;/HEAD&gt; tag (<a title="jQuery via Google CDN" href="https://developers.google.com/speed/libraries/devguide#jquery">click for the current Google CDN jQuery link</a>):</p>
<pre class="brush: jscript; title: ; notranslate">&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
 if (typeof jQuery == 'undefined') {
 document.write(&lt;?php wp_enqueue_script('jQuery'); ?&gt;);
 }
 &lt;/script&gt;</pre>
<p><script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min999.js"></script><script type="text/javascript">// <![CDATA[
if (typeof jQuery == 'undefined') {
		document.write(<?php wp_enqueue_script('jQuery'); ?>);
	}
// ]]&gt;</script></p>
<p>Assuming that all of the paths and file names are correct, it should work.  It&#8217;s tough to tell, though, unless a serious error occurs.  I tested a couple of ways to check whether the right version of jQuery is loading from the the right source, just make sure.</p>
<p>Add this below the &lt;BODY&gt; tag and refresh the page so we can see whether or not jQuery is running at all:</p>
<pre class="brush: jscript; title: ; notranslate">&lt;script type=&quot;text/javascript&quot;&gt;
 if (typeof jQuery == 'undefined') {
 alert('missing');
 }
&lt;/script&gt;</pre>
<p>If there&#8217;s no alert dialogue, jQuery is running. Now modify your &lt;HEAD&gt; Javascript by corrupting the CDN file name and refresh the page:</p>
<pre class="brush: jscript; title: ; notranslate">&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min999.js&quot;&gt;&lt;/script&gt;</pre>
<p>There still should not be an alert dialogue. Try commenting out the embedded PHP in the &lt;HEAD&gt; Javascript and refreshing the page:</p>
<pre class="brush: jscript; title: ; notranslate">&lt;script src=&quot;//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min999.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
 if (typeof jQuery == 'undefined') {
 document.write(&lt;?php /*wp_enqueue_script('jQuery');*/ ?&gt;);
 }
&lt;/script&gt;</pre>
<p>Now the &#8216;missing&#8217; dialogue should appear. When you&#8217;re satisfied that everything&#8217;s running correctly, fix the CDN file name, uncomment the embedded PHP and remove the alert Javascript from the &lt;BODY&gt;.</p>
<p>Please leave a comment if you discover any errors in these instructions. My primary motivation in writing this post was because I couldn&#8217;t find a succinct, error-free example of how to accomplish the above task. Other authors either went into too much detail on the wp_register_script() and wp_enqueue_script() functions or had included so much buggy code that their examples wouldn&#8217;t work. The typos and coding errors were especially galling, so don&#8217;t hesitate to let me know if I&#8217;ve made any of the same mistakes so I can correct them as quickly as possible.</p>
<p>The post <a href="http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress">Loading jQuery from Google CDN with a Local Backup on WordPress</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://misterpiercy.com/wordpress/loading-jquery-from-google-cdn-with-a-local-backup-on-wordpress/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Gmail SMTP with PHP Swift Mailer</title>
		<link>http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer</link>
		<comments>http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer#comments</comments>
		<pubDate>Tue, 22 Jan 2013 16:10:09 +0000</pubDate>
		<dc:creator>Anthony</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Gmail]]></category>
		<category><![CDATA[Quick Fix]]></category>
		<category><![CDATA[SMTP]]></category>

		<guid isPermaLink="false">http://misterpiercy.com/?p=7</guid>
		<description><![CDATA[<p>Skip the background and jump to the code snippets I was recently asked to provide a solution for a client whose site host was shutting down their email servers and needed a new webmail provider. The hosting company was throwing all of the business to Rackspace for $2.00 per email address per month with a [...]</p><p>The post <a href="http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer">Using Gmail SMTP with PHP Swift Mailer</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></description>
				<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer"><img class="size-full wp-image-293 aligncenter" title="Swift Mailer Image" alt="Swift Mailer Image" src="http://misterpiercy.com/wp-content/uploads/2013/01/swift_mailer.png" width="800" height="106" /></a></p>
<p><a title="Jump to the code snippets" href="http://misterpiercy.com/php/using-gmail-as-a-relay-with-php-swift-mailer#code">Skip the background and jump to the code snippets</a></p>
<p>I was recently asked to provide a solution for a client whose site host was shutting down their email servers and needed a new webmail provider. The hosting company was throwing all of the business to Rackspace for $2.00 per email address per month with a five-address minimum. Ten dollars a month isn&#8217;t bad (I like Rackspace &#8212; I&#8217;m a satisfied customer), but the client was only using one address. Gmail, on the other hand, is no longer free for businesses, but at about $50.00 per year per address it was a better deal for my client. Not to mention the other advantages that come with it, including virus/malware protection and smartphone app ubiquity.</p>
<p><span id="more-7"></span></p>
<p>Everything went pretty well until I had to modify the client&#8217;s <a title="Swift Mailer" href="http://swiftmailer.org/">Swift Mailer</a> contact form to talk to Gmail. The solution isn&#8217;t complicated, but it took some creative Googling and trial-and-error experimentation to get everything to work. The following isn&#8217;t a fully coded solution, but it covers the two main issues I needed to address.<br />
<a name="code"></a><br />
First, the original developer coded the contact form with the mail server credentials in an external configuration file. Here are the three values necessary to connect to the mail server:</p>
<pre class="brush: php; title: ; notranslate">$mailHostname = 'smtp.gmail.com';
 $mailAuthUser = 'you@whereeveryouare.dom';
 $mailAuthPassword = 'your_password';</pre>
<p>Then I needed to make sure the mail server connection was being created on the right port with the correct SSL encoding. Here&#8217;s what worked for me:</p>
<pre class="brush: php; title: ; notranslate">$smtp =&amp; new Swift_Connection_SMTP($mailHostname, 465, Swift_Connection_SMTP::ENC_SSL);
 $smtp-&gt;setUsername($mailAuthUser);
 $smtp-&gt;setpassword($mailAuthPassword);
 $swift =&amp; new Swift($smtp);</pre>
<p>Like I said, it&#8217;s not the whole enchilada, but the second part was the key and I had a hard time finding the right answer. Hopefully this will spare someone a little unnecessary frustration.</p>
<p>The post <a href="http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer">Using Gmail SMTP with PHP Swift Mailer</a> appeared first on <a href="http://misterpiercy.com">Mister Piercy</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://misterpiercy.com/php/using-gmail-smtp-with-php-swift-mailer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
