<?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>Gary&#039;s Code</title>
	<atom:link href="http://code.garyjones.co.uk/feed" rel="self" type="application/rss+xml" />
	<link>http://code.garyjones.co.uk</link>
	<description>A store for the bits of code I&#039;m always forgetting...</description>
	<lastBuildDate>Fri, 17 May 2013 22:09:08 +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>Gravity Forms / jQuery UI Datepicker Too Narrow (Box-sizing)</title>
		<link>http://code.garyjones.co.uk/gravity-forms-jquery-ui-datepicker-too-narrow</link>
		<comments>http://code.garyjones.co.uk/gravity-forms-jquery-ui-datepicker-too-narrow#comments</comments>
		<pubDate>Mon, 30 Jul 2012 15:32:04 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2086</guid>
		<description><![CDATA[This was my view of a Gravity Forms datepicker, but the problem of the pop-up container being too narrow may affect other instances of the jQuery UI Datepicker too. Gravity Forms 1.6.5 still uses it&#8217;s own jQuery UI 1.6 files, instead of the UI 1.8+ files now included with WordPress core. The width of the [...]]]></description>
				<content:encoded><![CDATA[<div id="attachment_2087" class="wp-caption aligncenter" style="width: 294px"><img src="http://code.garyjones.co.uk/files/datepicker-before.png" alt="Screenshot of a datepicker that has the content cut-off on the right side" title="Datepicker Before" width="284" height="284" class="size-full wp-image-2087" /><p class="wp-caption-text">Datepicker &#8211; dynamically sized container is too narrow</p></div>
<p>This was my view of a <a href="http://gmj.to/gravityforms/">Gravity Forms</a> datepicker, but the problem of the pop-up container being too narrow may affect other instances of the jQuery UI Datepicker too.</p>
<p>Gravity Forms 1.6.5 still uses it&#8217;s own jQuery UI 1.6 files, instead of the UI 1.8+ files now included with WordPress core. The width of the container is added as an inline style by the core jQuery UI Datepicker 1.6 code:</p>
<a href="https://gist.github.com/3207635" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>Even without knowing what any of the variables are, it&#8217;s clear that the width is taken as the product of the number of months shown (usually one, but can be two) and the width of the <code>.ui-datepicker</code>, which is the table of dates inside the container.</p>
<p>Since Gravity Forms was providing the styles for all aspects of the pop-up, including the top dropdowns and table cell appearance, it was sensible to assume that its CSS was fine on it&#8217;s own.</p>
<h2>Box-sizing</h2>
<p>I&#8217;d recently added the code from Paul Irish&#8217;s <a href="http://paulirish.com/2012/box-sizing-border-box-ftw/"><code>box-sizing</code></a> article, so that all elements would use the <code>border-box</code> layout system.</p>
<p>The solution then, was to revert just the problem element back to using <code>content-box</code>:</p>
<a href="https://gist.github.com/3207685" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>With this put into a theme&#8217;s <code>style.css</code> file, the container has the same width value applied around its content, padding and border, instead of just its content.</p>
<div id="attachment_2088" class="wp-caption aligncenter" style="width: 294px"><a href="http://code.garyjones.co.uk/files/datepicker-after.png"><img src="http://code.garyjones.co.uk/files/datepicker-after.png" alt="Screenshot showing a nicely formatted datepicker" title="Datepicker After" width="284" height="284" class="size-full wp-image-2088" /></a><p class="wp-caption-text">Datepicker &#8211; formatting fixed.</p></div>
<p>Simple enough, but hopefully this post can save someone a little time.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/gravity-forms-jquery-ui-datepicker-too-narrow/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why @return void is wrong in PHP documentation Putting an end to a bad practice</title>
		<link>http://code.garyjones.co.uk/why-return-void-is-wrong</link>
		<comments>http://code.garyjones.co.uk/why-return-void-is-wrong#comments</comments>
		<pubDate>Thu, 08 Mar 2012 14:14:38 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[documentation]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2083</guid>
		<description><![CDATA[When documenting PHP, there are two schools of thought regarding the use of @return tags in DocBlocks when the function or method being documented doesn&#8217;t actually have a return keyword: Don&#8217;t include a @return tag. Include a @return tag with a type of void. I&#8217;m not saying that either is wrong, but the second-one is [...]]]></description>
				<content:encoded><![CDATA[<p>When documenting PHP, there are two schools of thought regarding the use of <code>@return</code> tags in DocBlocks when the function or method being documented doesn&#8217;t actually have a <code>return</code> keyword:</p>
<ol>
<li>Don&#8217;t include a <code>@return</code> tag.</li>
<li>Include a <code>@return</code> tag with a type of <code>void</code>.</li>
</ol>
<p>I&#8217;m not saying that either is wrong, but the second-one is most definitely as far from correct as you can get.</p>
<p>Let&#8217;s look at the reasons.<br />
<span id="more-2083"></span></p>
<h2>Logic and Standards</h2>
<p><a href="http://code.garyjones.co.uk/files/return-void.png"><img src="http://code.garyjones.co.uk/files/return-void.png" alt="" title="return-void" width="300" height="177" class="alignright size-full wp-image-2084" /></a>The <code>@return</code> tag documentation for phpDocumentor, the <em>de facto</em> standard for PHP documentation <a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_tags.return.pkg.html">says</a>:</p>
<blockquote><p>The @return tag is used to document the return value of functions or methods.</p></blockquote>
<p>In our scenario, there is no explicit return value, so there shouldn&#8217;t be a <code>@return</code> tag, just the same as you wouldn&#8217;t include a <code>@param</code> tag when there are no arguments, or a <code>@global</code> tag when there&#8217;s no global variable being used.</p>
<p>The <a href="http://en.wikipedia.org/wiki/PHPDoc">Wikipedia</a> page for PHPDoc states that the @return tag should not be used for a void / no return value.</p>
<p>Furthermore, the source code examples <a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_sample2.pkg.html">2</a> and <a href="http://manual.phpdoc.org/HTMLSmartyConverter/HandS/phpDocumentor/tutorial_sample3.pkg.html">3</a> on the phpdoc.org website clearly omit the <code>@return</code> tag when there is no return keyword.</p>
<p>The draft <a href="https://github.com/phpDocumentor/phpDocumentor2/blob/develop/docs/PSR.md">PHPDoc PSR</a>, a document which hopes to become the <em>de jure</em> standard, says it is optional, but this is only so that it stays somewhat compatible with the existing (poor) real world practises.</p>
<h2>Void !== Null</h2>
<p>The <a href="http://php.net/manual/en/functions.returning-values.php">PHP Manual</a> clearly states that:</p>
<blockquote><p>If the return() is omitted the value NULL will be returned.</p></blockquote>
<p>Null and void are not the same, so by including <code>@return void</code> you&#8217;re actually giving wrong documentation, which is worse than no documentation.</p>
<h2>Void is not a data type</h2>
<p>The phpDocumentor documentation goes on to say:</p>
<blockquote><p>The datatype should be a valid PHP type (int, string, bool, etc), a class name for the type of object returned, or simply &#8220;mixed&#8221;.</p></blockquote>
<p>As <a href="http://php.net/manual/en/language.pseudo-types.php">noted</a> in the PHP manual, <code>void</code> is not a valid PHP type. At best, it&#8217;s a pseudo-type, and only used to describe PHP functions for the purposes of documenting the C code that PHP is actually written in. It&#8217;s not suitable for documenting PHP code.</p>
<h2>Code Dilution</h2>
<p>There&#8217;s little benefit having a tag that says that nothing is returned, when you can save a line of comment code and assume that the return keyword is not present when the @return tag is not present.</p>
<h2>IDEs</h2>
<p>An IDE such as Netbeans, Zend Studio, Eclipse, PHPStorm can often generate the basic documentation when a shortcut like <code>/**</code> followed by the Enter key is typed right above an entity that can have documentation. The default behaviour is that these only include the <code>@return</code> tag in the documentation when the <code>return</code> keyword is present.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/why-return-void-is-wrong/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Line-up Vendor Prefixed Property Values Make your CSS easier to scan and edit</title>
		<link>http://code.garyjones.co.uk/line-up-vendor-prefixed-property-values</link>
		<comments>http://code.garyjones.co.uk/line-up-vendor-prefixed-property-values#comments</comments>
		<pubDate>Sun, 04 Mar 2012 13:17:38 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2080</guid>
		<description><![CDATA[Making code easier to read is a useful thing. I often make a point of lining up assignment operators or array values in PHP as I find it far easier to scan. I&#8217;ve now got a tip for doing something similar in CSS. When doing a Genesis child theme audit for a client recently, I [...]]]></description>
				<content:encoded><![CDATA[<p>Making code easier to read is a useful thing. I often make a point of lining up assignment operators or array values in PHP as I find it far easier to scan. I&#8217;ve now got a tip for doing something similar in CSS.</p>
<p><span id="more-2080"></span>When doing a <a href="http://gamajo.com/">Genesis child theme audit</a> for a client recently, I came across the following CSS ruleset:</p>
<a href="https://gist.github.com/1972901" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>The standard adopted for CSS at StudioPress is simply to have all properties in alphabetical order &#8211; no exceptions. It&#8217;s slightly different from the WordPress Coding Standards for CSS, but it&#8217;s also far easier to remember and not so ambiguous. From that, I&#8217;d previously suggested to this and other clients that vendor prefixed properties should also be alphabetical, and therefore separated from the standard properties, by being at the top.</p>
<p>This does make it trickier to read and as such, it isn&#8217;t easy to spot the missing space on that webkit prefixed property value. Go on, admit it, you didn&#8217;t spot it either <img src='http://code.garyjones.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I recently read a short post from someone (I&#8217;m really sorry, I didn&#8217;t take note of who it was) that said that they prefer to line up the colon on vendor-prefixed and standard properties, which makes it easier to read. They would have lined up the following (still otherwise keeping rules in alphabetical order) like so (with the missing space added back in):</p>
<a href="https://gist.github.com/1972901" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>That is much easier to read, easier to visually scan that it&#8217;s consistent across the property variations, and allows text editors that can edit vertically to amend all of the values consistently in one go.</p>
<p>Another variation, and now my currently preferred format, is to line-up the start of the values:</p>
<a href="https://gist.github.com/1972901" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>This means that only tabs (or a consistent number of spaces) are used at the start of the line, and extra spaces are added into the middle of the line; this is fine, since some particularly long values may be wrapped onto new lines anyway (exact details of which are outside the scope of this discussion).</p>
<p>Why not give this alignment a go, and tell me how you get on?</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/line-up-vendor-prefixed-property-values/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enqueued Style Sheet Extras Fine-tuning your additional style sheets</title>
		<link>http://code.garyjones.co.uk/enqueued-style-sheet-extras</link>
		<comments>http://code.garyjones.co.uk/enqueued-style-sheet-extras#comments</comments>
		<pubDate>Fri, 02 Mar 2012 19:16:43 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[style sheets]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2078</guid>
		<description><![CDATA[The WP_Styles class in WordPress allows for a few extra bits of fine-tuning via the extra property, which is amended by calling add_data( $handle, $key, $value ) method on the global $wp_styles. Persistent, Preferred and Alternate Style Sheets Back at the end of 1999, the HTML4 spec defined persistent, preferred and alternate style sheets, and [...]]]></description>
				<content:encoded><![CDATA[<p>The <code>WP_Styles</code> class in WordPress allows for a few extra bits of fine-tuning via the <code>extra</code> property, which is amended by calling <code>add_data( $handle, $key, $value )</code> method on the global <code>$wp_styles</code>.</p>
<p><span id="more-2078"></span><br />
<h2 id="alternate">Persistent, Preferred and Alternate Style Sheets</h2>
<p>Back at the end of 1999, the HTML4 spec defined <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.3.1">persistent, preferred and alternate style sheets</a>, and several of the browsers at the time implemented a user interface for users to access these as they wanted.</p>
<p>Several better concepts came along, such as sites doing on-site front-end or back-end style switchers, which solved some of the issues such as persistence on page reloads, supporting browsers which didn&#8217;t yet support a user interface, and avoiding downloading multiple style sheets that a user may never actually select.</p>
<p>Persistent style sheets are always loaded by the browser, and the <code>link</code> element does not have a <code>title</code> attribute. The Preferred (default) alternate style sheet has a <code>title</code> attribute, and the other alternate style sheets also have <code>alternate</code> as one of the <code>rel</code> attribute values.</p>
<p>However, the technique is still valid today, and can be implemented when enqueueing style sheets in WordPress. Here&#8217;s how you might add a couple of alternative style sheets (with one marked as the default alternative, or preferred) for instance:</p>
<a href="https://gist.github.com/1960177" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>On Firefox for instance, a user can pick between these style sheets via the View -> Page Styles menu item:<br />
<div id="attachment_2079" class="wp-caption aligncenter" style="width: 403px"><a href="http://code.garyjones.co.uk/files/preferred-alternate-style-sheets.png"><img src="http://code.garyjones.co.uk/files/preferred-alternate-style-sheets.png" alt="Screenshot showing selecting between preferred and alternate style sheets in Firefox" title="Selecting between preferred and alternate style sheets" width="393" height="218" class="size-full wp-image-2079" /></a><p class="wp-caption-text">Selecting between preferred and alternate style sheets in Firefox</p></div></p>
<h2 id="ie">Internet Explorer Style Sheets</h2>
<p>Another extra is the ability to set a conditional comment, as used for adding IE-specific style sheets. <a href="http://code.garyjones.co.uk/ie-conditional-style-sheets-wordpress/" title="How to Conditionally Add Style Sheets for IE in WordPress">Previously</a> it had to be done by enqueueing the style sheet for all browsers, and then filtering the <code>style_loader_tag</code> for that handle and adding the conditional comments in around it. Now we can just do:</p>
<a href="https://gist.github.com/1960257" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>This has the advantage of being significantly less code, and the actual condition could come from a variable or be filterable.</p>
<h2>Other Extras</h2>
<p>WordPress also appears to support other extras, such as <code>rtl</code> which would allow you to mark an enqueued style sheet as only being referenced if the site was set to use a right-to-left language (the <a href="http://codex.wordpress.org/Right_to_Left_Language_Support">best practice</a> is to create a style sheet called <code>rtl.css</code> which does this automatically). Other extras include <code>suffix</code> and <code>after</code> although these are used more by WordPress internally for setting the reference to a minified / non-minified file, and for setting internal style sheet data to appear after a specific external style sheet reference via <code>wp_add_inline_style()</code>.</p>
<p>Since the name of the extra key is not fixed, you could add some of your own arbitrary meta data to associate with an enqueued style sheet (remember to prefix the key so you avoid any potential clashes with WordPress-supported keys in the future). </p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/enqueued-style-sheet-extras/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Get a Google Developer API Key How to access the Web Fonts API</title>
		<link>http://code.garyjones.co.uk/google-developer-api-key</link>
		<comments>http://code.garyjones.co.uk/google-developer-api-key#comments</comments>
		<pubDate>Wed, 15 Feb 2012 12:00:57 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2072</guid>
		<description><![CDATA[To get developer API (application programming interface) access to several of the Google services, you need to have an API key. This is so Google can tell who is accessing the service, and ensure that each person stays below the courtesy daily limit for the number of requests. Here we look at how to allow [...]]]></description>
				<content:encoded><![CDATA[<p>To get developer <abbr>API</abbr> (application programming interface) access to several of the Google services, you need to have an <abbr>API</abbr> key. This is so Google can tell who is accessing the service, and ensure that each person stays below the courtesy daily limit for the number of requests.</p>
<p>Here we look at how to allow access for, and get a key for, the Google Web Fonts <abbr>API</abbr>.</p>
<p><span id="more-2072"></span></p>
<ol>
<li>Head to the <a href="https://code.google.com/apis/console" title="Google APIs Console">Google <abbr>API</abbr>s Console</a>. If you&#8217;re not already logged in to Google, you&#8217;ll need to do that when requested.</li>
<li>On the left menu, select the <a href="https://code.google.com/apis/console#services">Services</a> item. If the Terms of Service appear, read and accept them.<div id="attachment_2073" class="wp-caption aligncenter" style="width: 215px"><a href="http://code.garyjones.co.uk/files/web-fonts-api-key-1.png"><img src="http://code.garyjones.co.uk/files/web-fonts-api-key-1.png" alt="Left menu with the Services item highlighted on the Google APIs Console" title="Services item on the Google APIs Console" width="205" height="203" class="size-full wp-image-2073" /></a><p class="wp-caption-text">The Services item in the left menu of the Google APIs Console</p></div></li>
<li>You should be presented with a list of services provided by Google. Scroll to the bottom and click the button next to the Web Fonts item, so it turns from off to on.<div id="attachment_2074" class="wp-caption aligncenter" style="width: 670px"><a href="http://code.garyjones.co.uk/files/web-fonts-api-key-2.png"><img src="http://code.garyjones.co.uk/files/web-fonts-api-key-2.png" alt="Web Fonts API access button in the Google APIs Console" title="Web Fonts API Access" width="660" height="55" class="size-full wp-image-2074" /></a><p class="wp-caption-text">Web Fonts API access button in the Google APIs Console</p></div></li>
<li>On the left menu, select the <a href="https://code.google.com/apis/console#access">API Access</a> item. The <abbr>API</abbr> key is near the bottom of that pane, in the section titled &#8220;Simple API Access.&#8221;<div id="attachment_2075" class="wp-caption aligncenter" style="width: 664px"><a href="http://code.garyjones.co.uk/files/web-fonts-api-key-3.png"><img src="http://code.garyjones.co.uk/files/web-fonts-api-key-3.png" alt="Simple API Access pane in Google APIs Console" title="Simple API Access pane in Google APIs Console" width="654" height="187" class="size-full wp-image-2075" /></a><p class="wp-caption-text">Simple API Access pane in Google APIs Console</p></div></li>
</ol>
<p>You can now enter your personal <abbr>API</abbr> key in whichever tool or <abbr title="uniform resource locator">URL</abbr> needed it. For example, enter it at the end of https://www.googleapis.com/webfonts/v1/webfonts?key= and you&#8217;ll see a full list of web fonts provided by Google.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/google-developer-api-key/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Phing Build File General default build file for automating a PHP project</title>
		<link>http://code.garyjones.co.uk/phing-build-file</link>
		<comments>http://code.garyjones.co.uk/phing-build-file#comments</comments>
		<pubDate>Mon, 13 Feb 2012 12:00:22 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[phing]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2068</guid>
		<description><![CDATA[On my computer I have Jenkins installed for viewing analysis of code, and as I code with PHP and not Java, I use Phing instead of Ant as the build system. I run several PHP programs against the code I&#8217;ve written or auditing, and automate the creation of API documentation using DocBlox, as well as [...]]]></description>
				<content:encoded><![CDATA[<p><div id="attachment_2071" class="wp-caption alignright" style="width: 310px"><a href="http://code.garyjones.co.uk/files/jenkins.png"><img src="http://code.garyjones.co.uk/files/jenkins-300x253.png" alt="Screenshot of Jenkins" title="Jenkins" width="300" height="253" class="size-medium wp-image-2071" /></a><p class="wp-caption-text">Jenkins, powered by my Phing build file</p></div>
<p>On my computer I have <a href="http://jenkins-ci.org/">Jenkins</a> installed for viewing analysis of code, and as I code with PHP and not Java, I use <a href="http://phing.info/">Phing</a> instead of Ant as the build system. I run several PHP programs against the code I&#8217;ve written or auditing, and automate the creation of API documentation using <a href="http://docblox-project.org/">DocBlox</a>, as well as send that documentation via FTP to a <a href="http://docs.garyjones.co.uk/">docs</a> subdomain.</p>
<p>I&#8217;ve refined my build file over time, but it has always been pretty much an identical file duplicated over many projects, and this wasn&#8217;t scaling well as I found the need to refine it further. Instead, I discovered the <a href="http://www.phing.info/docs/guide/trunk/chapters/appendixes/AppendixB-CoreTasks.html#ImportTask">ImportTask</a> in Phing, which meant I could have one generic build file kept outside of my project folders, and import that into each bare bones project build file and amend as necessary.</p>
<p><span id="more-2068"></span>Here&#8217;s my generic build file code (obviously you may have a different set of targets and procedures you want to undertake like unit testing, deploying to git or svn, etc.):</p>
<a href="https://gist.github.com/3851539" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>And then each project build file is simply:</p>
<a href="https://gist.github.com/3851539" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>If I want to create a tweaked target for a particular project, then I can simply add that to the project build file (as per the commented-out section), and it takes precedence over the generic target of the same name. An example of this is the following, which adds a custom target when parsing the coding standards for the WordPress project, so it can exclude all of the 3<sup>rd</sup> party libraries that won&#8217;t be expected to follow the coding standards:</p>
<a href="https://gist.github.com/3851539" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>That default build file pulls in both a global default properties file, and a per-project properties file too, with the properties in the latter taking precedence. Here&#8217;s an example of my global default properties file:</p>
<a href="https://gist.github.com/3851539" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>Which leaves a typical per-project properties file down to the bare basics:</p>
<a href="https://gist.github.com/3851539" target="_blank"><em>View this code snippet on GitHub.</em></a>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/phing-build-file/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Genesis Grid Loop Advanced Revamped Genesis tutorial from Bill Erickson and Gary Jones</title>
		<link>http://code.garyjones.co.uk/genesis-grid-loop-advanced</link>
		<comments>http://code.garyjones.co.uk/genesis-grid-loop-advanced#comments</comments>
		<pubDate>Sun, 12 Feb 2012 04:30:07 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[Genesis]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2066</guid>
		<description><![CDATA[This post is an update to a previous post on the Genesis Grid Loop. That previous post had some shortcomings, especially concerning the number of grid posts and the number of posts as set in Settings -> Reading. If they didn&#8217;t match, then WordPress would declare one or more pages at the end of the [...]]]></description>
				<content:encoded><![CDATA[<p class="notice"><strong>This post is an update to a <a href="http://code.garyjones.co.uk/genesis-grid-loop">previous post on the Genesis Grid Loop</a>.</strong></p>
<p>That previous post had some shortcomings, especially concerning the number of grid posts and the number of posts as set in Settings -> Reading. If they didn&#8217;t match, then WordPress would declare one or more pages at the end of the pagination for those query of posts as being a 404 Not Found. We needed a better solution, and between legendary Genesis developer <a href="http://billerickson.net/">Bill Erickson</a> and myself, we&#8217;ve come up with one.</p>
<p><span id="more-2066"></span></p>
<h2>The Code</h2>
<p>Here&#8217;s some starting code that you can customise. More explanation is given below the code.</p>
<a href="https://gist.github.com/1806146" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>Woah! That&#8217;s a ton more code, but it is a more stable solution as a base from which you can customise the how the grid loop works for you. Here&#8217;s the breakdown.</p>
<h2>Explanation of The Code</h2>
<h3><code>child_is_doing_grid_loop()</code></h3>
<p>This first function simply returns true or false. You can use the <a href="http://codex.wordpress.org/Conditional_Tags" title="Codex: Conditional Tags">conditional tags</a> to choose under which situations you want the grid loop to kick in. By default, we want it when it is not a single post (including custom post types), not a single page and not a single attachment. Luckily WordPress has a tag to cover all three of those at once. Every other time we want to use the grid loop.</p>
<h3><code>child_grid_loop_arguments()</code></h3>
<p>The second function is where you&#8217;ll want to fine tune how the grid appears. Most of the array values should be intuitively named. If you want to limit a template to show a particular query (i.e., posts from the same category), then you&#8217;d amend the <code>$query_args</code> here.</p>
<h3><code>child_prepare_grid_loop()</code></h3>
<p>You shouldn&#8217;t really need to touch much in this function. This basically says to swap out the default function for our grid loop function and also amend the post class so we can add some styling later.</p>
<h3><code>child_grid_query()</code></h3>
<p>This amends what the query would have been for this page, with our grid loop and query arguments. After checking that this is the main loop, that we are indeed supposed to be showing the grid loop, and we&#8217;re on the front end, then it grabs a copy of our arguments. To allow for featured posts on the first page, and to keep the balance right on pages after the first page, some logic is done, which you probably won&#8217;t need to edit. The result of this logic is then set on the main query.</p>
<h3><code>child_do_grid_loop()</code></h3>
<p>This function gets our grid loop arguments, the query arguments (as potentially amended by the logic in the previous function), and merges them together before sending them all off to Genesis, which does the actual database query, and starts echoing the markup and content for this grid posts.</p>
<h3><code>child_grid_loop_post_class()</code></h3>
<p>The previous version of this tutorial also included some styles to paste into your style.css file, to ensure that the grid posts appeared in the correct columns. We now do a bit more work here, and make use of the column classes that have been included with Genesis child themes since Genesis 1.5 was released. If you find the grid isn&#8217;t appearing correctly, copy the Column Classes section of the Genesis style sheet into your own theme style sheet.</p>
<h3>Sticky Posts</h3>
<p>If you amend the query arguments for a grid on the blog archive page to only include posts from a certain category, tag or taxonomy, and find that sticky posts stop working, add the following code to fix it:</p>
<a href="https://gist.github.com/1950278" target="_blank"><em>View this code snippet on GitHub.</em></a>
<h3>A Better and Easier Grid Loop</h3>
<p>It should be noted that the grid loop code above is for when you want to create a second loop on the page, or make use of some custom query loop that won&#8217;t produce the same posts as what would naturally have appeared there anyway.</p>
<p>If you <em>do</em> just want to style the existing posts, then take a look at a new tutorial from Bill Erickson, as he explains about <a href="http://www.billerickson.net/a-better-and-easier-grid-loop/">a better and easier grid loop</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/genesis-grid-loop-advanced/feed</wfw:commentRss>
		<slash:comments>35</slash:comments>
		</item>
		<item>
		<title>Genesis Split Sidebars Make the primary sidebar split into two equal sidebars</title>
		<link>http://code.garyjones.co.uk/genesis-split-sidebars</link>
		<comments>http://code.garyjones.co.uk/genesis-split-sidebars#comments</comments>
		<pubDate>Fri, 12 Aug 2011 13:52:44 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[Genesis]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2051</guid>
		<description><![CDATA[Visually split the primary sidebar in Genesis into two further sidebars, each with their own widget area. For more info about genesis_register_sidebar() see the StudioPress tutorial on How to Register a Widget Area. PHP View this code snippet on GitHub. CSS View this code snippet on GitHub. The Result]]></description>
				<content:encoded><![CDATA[<p>Visually split the primary sidebar in <a href="http://genesis-theme-framework.com/">Genesis</a> into two further sidebars, each with their own widget area. For more info about <code>genesis_register_sidebar()</code> see the StudioPress tutorial on <a href="http://www.studiopress.com/tutorials/register-widget-area" title="StudioPress: How to Register a Widget Area">How to Register a Widget Area</a>.</p>
<p><span id="more-2051"></span></p>
<h2>PHP</h2>
<a href="https://gist.github.com/1698319" target="_blank"><em>View this code snippet on GitHub.</em></a>
<h2>CSS</h2>
<a href="https://gist.github.com/1698319" target="_blank"><em>View this code snippet on GitHub.</em></a>
<h2>The Result</h2>
<p><a href="http://code.garyjones.co.uk/genesis-split-sidebars/split-sidebars/" rel="attachment wp-att-2053"><img src="http://code.garyjones.co.uk/files/split-sidebars.png" alt="" title="Split Sidebars" width="500" height="502" class="aligncenter size-full wp-image-2053" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/genesis-split-sidebars/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>HTTP Error Fix Can now upload large images</title>
		<link>http://code.garyjones.co.uk/http-error-fix</link>
		<comments>http://code.garyjones.co.uk/http-error-fix#comments</comments>
		<pubDate>Sun, 07 Aug 2011 17:16:43 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2049</guid>
		<description><![CDATA[When uploading large images over an approximate size (~2500&#215;2000) I was encountering the HTTP Error message when trying to crunch the image (which ultimately fails and doesn&#8217;t produce the smaller pre-defined image sizes). After trying several solutions, the following appears to have solved it for my setup, once and for all &#8211; add this to [...]]]></description>
				<content:encoded><![CDATA[<p>When uploading large images over an approximate size (~2500&#215;2000) I was encountering the <code style="color: red;font-weight:bold">HTTP Error</code> message when trying to crunch the image (which ultimately fails and doesn&#8217;t produce the smaller pre-defined image sizes).</p>
<p>After trying several solutions, the following appears to have solved it for my setup, once and for all &#8211; add this to your <code>.htaccess</code> file:</p>
<p><span id="more-2049"></span></p>
<a href="https://gist.github.com/1698353" target="_blank"><em>View this code snippet on GitHub.</em></a>
<p>In short, it massively bumps up the allowed memory limit, and also tries to turn off some security aspects for the file that deals with the uploading, under different module setups.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/http-error-fix/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Style Sheet Header Improvements Tidy up your WordPress Theme Details</title>
		<link>http://code.garyjones.co.uk/style-sheet-header-improvements</link>
		<comments>http://code.garyjones.co.uk/style-sheet-header-improvements#comments</comments>
		<pubDate>Thu, 02 Jun 2011 00:14:25 +0000</pubDate>
		<dc:creator>Gary Jones</dc:creator>
				<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://code.garyjones.co.uk/?p=2046</guid>
		<description><![CDATA[The Theme Review Guidelines are often updated as each new version of WordPress is released, and although these guidelines are for themes submitted to the WordPress theme repository, they are a good baseline to which all themes should strive to achieve. If your theme was written a while ago, your site might not be following [...]]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://codex.wordpress.org/Theme_Review">Theme Review Guidelines</a> are often updated as each new version of WordPress is released, and although these guidelines are for themes submitted to the <a href="http://wordpress.org/extend/themes/">WordPress theme repository</a>, they are a good baseline to which all themes should strive to achieve.</p>
<p>If your theme was written a while ago, your site might not be following all of the current best practices. Here are a few simple alterations you can make to your <code>style.css</code> file.</p>
<p><span id="more-2046"></span><br />
<h2 id="theme-uri">Theme URI</h2>
<p>An easy one to start &#8211; in the header info, you&#8217;ll likely find a line starting with <code>Theme URL</code> (note the last character). This should now strictly be <code>Theme URI</code>.</p>
<h2 id="license">License</h2>
<p>In your theme, you might see some inconsistent or no license information at all. There are now a couple of specific slugs you can use, <code>License</code> and <code>License URI</code>, to show the same information in a way that WordPress can read from (example):</p>
<a href="https://gist.github.com/1698383" target="_blank"><em>View this code snippet on GitHub.</em></a>
<h2 id="tags">Tags</h2>
<p>Tags haven&#8217;t been added to many themes at the moment, yet if you&#8217;ve got a lot of themes installed, being able to filter them to just certain features (see Appearance -> Themes -> Feature Filter, right-hand side, next to the Search button) could be useful. Many of the tags could be added by the functionality that a parent theme like <a href="http://genesis-theme-framework.com/">Genesis</a> provides, while some would be child theme specific. A theme that could theoretically meet every single tag would include the following:</p>
<a href="https://gist.github.com/1698372" target="_blank"><em>View this code snippet on GitHub.</em></a>
<h2 id="trailing-slash">Trailing Slash</h2>
<p>Another easy one &#8211; if the <code>Theme URI</code> or <code>Author URI</code> values are the home page of a website, add a trailing slash to it &#8211; this typically saves an extra lookup on a server if someone clicks on the link.</p>
<h2 id="theme-name">Theme Name</h2>
<p>Some themes might be named as &#8220;&#8230; Theme&#8221; or &#8220;&#8230; Child Theme&#8221;. The Theme Review guidelines recommend that the term &#8220;Theme&#8221; is not included (as everyone knows it&#8217;s a theme). Since the guidelines also suggest that the fact a theme is a child theme be mentioned in the <code>Description</code>, your theme could drop both terms. <strong>Switch to another theme before changing your theme name.</strong></p>
<h2 id="template-version">Template Version</h2>
<p>Previously there was a suggestion to include a <code>Template Version</code> slug to child themes to indicate what version of the parent theme the child theme was built against. However, this appears to have been removed until such time that WordPress can actually use this information to notify users.</p>
<h2 id="further-information">Further Information</h2>
<p>Beyond the changes listed above, you can find more information via the <a href="http://codex.wordpress.org/Theme_Review">theme review guidelines</a>, by following the <a href="http://make.wordpress.org/themes">Theme Review Team</a> discussions, and also by running the <a href="http://wordpress.org/extend/plugins/theme-check/">Theme Check</a> plugin (the development version has a few extra fixes) on your theme. WordPress also has a set of <a href="http://make.wordpress.org/core/handbook/coding-standards/css/">CSS Coding Standards</a> for the main portion of yout style sheet.</p>
]]></content:encoded>
			<wfw:commentRss>http://code.garyjones.co.uk/style-sheet-header-improvements/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
