<?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>Hugh Lashbrooke</title>
	<atom:link href="http://www.hughlashbrooke.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hughlashbrooke.com</link>
	<description>WordPress developer at WooThemes</description>
	<lastBuildDate>Fri, 10 May 2013 08:01:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Seriously Simple Podcasting &#8211; User Survey</title>
		<link>http://www.hughlashbrooke.com/seriously-simple-podcasting-user-survey/</link>
		<comments>http://www.hughlashbrooke.com/seriously-simple-podcasting-user-survey/#comments</comments>
		<pubDate>Fri, 26 Apr 2013 13:27:20 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=2995</guid>
		<description><![CDATA[Since my podcasting plugin, Seriously Simple Podcasting, has become relatively popular I am doing some customer research for the next steps for the plugin's development. Any answers you can give will be invaluable.]]></description>
				<content:encoded><![CDATA[<p>In December last year I released a <a title="Seriously Simple Podcasting" href="http://wordpress.org/extend/plugins/seriously-simple-podcasting/" target="_blank">podcasting plugin</a>, descriptively named <em>Seriously Simple Podcasting</em>, that I originally built for use on my church&#8217;s website &#8211; it&#8217;s been just over 4 months since I released it and, at the time of writing this post, it has been download 5345 times. It is currently sitting at v1.4.6 and is now at a point where it is entirely stable and there are no bugs or niggles that are holding it back. Since I released the plugin I have been offering free support using the support forum built into the WordPress plugin repository and things have been moving along smoothly with every support ticket resolved so far.</p>
<p>I have been pleasantly surprised by the uptake and popularity of the plugin so far, so I have decided to do some quick customer research into what features people would like to have added to it and to see whether or not there is a market for releasing a premium version of the plugin with some of these new features. I put together a <a title="Seriously Simple Podcasting - User Survey" href="https://docs.google.com/forms/d/1PbMBocuGZq4K_LV2dL-GfmAJwNlsT76HUbr5fgRZxfo/viewform" target="_blank">quick survey</a> asking some open questions about this, so if you have enjoyed the plugin and you have a spare minute please go ahead and fill it out &#8211; the more responses I receive the better!</p>
<p><a target="_blank" href="http://wordpress.org/extend/plugins/seriously-simple-podcasting/" class="woo-sc-button  custom" style="background:;border-color:"><span class="woo-">Download the plugin</span></a> <a target="_blank" href="https://docs.google.com/forms/d/1PbMBocuGZq4K_LV2dL-GfmAJwNlsT76HUbr5fgRZxfo/viewform" class="woo-sc-button  custom" style="background:;border-color:"><span class="woo-">Fill out the survey</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/seriously-simple-podcasting-user-survey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A .gitignore file for multiple WordPress sites in one repo</title>
		<link>http://www.hughlashbrooke.com/a-gitignore-file-for-multiple-wordpress-sites-in-one-repo/</link>
		<comments>http://www.hughlashbrooke.com/a-gitignore-file-for-multiple-wordpress-sites-in-one-repo/#comments</comments>
		<pubDate>Thu, 25 Apr 2013 14:26:35 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[GitHub]]></category>
		<category><![CDATA[Productivity]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=2983</guid>
		<description><![CDATA[I put together a .gitignore file that will exclude all WordPress core files from your repo so that only your themes and plugins will be uploaded - this works recursively, so that it will ignore all the copies of WordPress you have in the sub-folders of the repo.]]></description>
				<content:encoded><![CDATA[<p>After holding off for a while, I finally got round to moving all of my client projects into a single (private) GitHub repo and the whole process was a lot less painful than I expected it to be. In the end, I only had one issue and that was crafting my .gitignore file so that the WordPress core files for each project didn&#8217;t all get uploaded to my repo (that would be a sure way to <a title="GitHub - What is my disk quota?" href="https://help.github.com/articles/what-is-my-disk-quota" target="_blank">upset the fine folks at GitHub</a>). The file wasn&#8217;t too tough to get right, but I thought it worth sharing in case anyone else is struggling with the same thing.</p>
<p>So here is a .gitignore file that will exclude all WordPress core files from your repo so that only your themes and plugins will be uploaded &#8211; this works recursively, so that it will ignore all the copies of WordPress you have in the sub-folders of the repo.</p>
<pre id="code_snippet_351" style="position:relative;width:100%;border:0;padding:0;">.htaccess
wp-admin/
wp-includes/
wp-config.php
*/wp-content/uploads/
*/wp-content/blogs.dir/
*/wp-content/upgrade/
*/wp-content/backup-db/
*/wp-content/advanced-cache.php
*/wp-content/wp-cache-config.php
*/wp-content/index.php
*/wp-content/themes/index.php
*/wp-content/plugins/index.php
*/index.php
*.log
wp-content/cache/
wp-content/backups/
sitemap.xml
sitemap.xml.gz
wp-activate.php
wp-app.php
wp-blog-header.php
wp-comments-post.php
wp-config-sample.php
wp-config.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-pass.php
wp-register.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
license.txt
readme.html</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/a-gitignore-file-for-multiple-wordpress-sites-in-one-repo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code template for a WordPress plugin</title>
		<link>http://www.hughlashbrooke.com/code-template-for-a-wordpress-plugin/</link>
		<comments>http://www.hughlashbrooke.com/code-template-for-a-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 02 Mar 2013 14:13:24 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=2789</guid>
		<description><![CDATA[I've been working on a lot of plugins lately - many for my work at WooThemes and a few for my personal projects - and over time I have developed a standard code base from which I start any of my new plugins. I decided to share that code base here.]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been working on a lot of plugins lately &#8211; many for my work at <a title="WooThemes" href="http://www.woothemes.com/" target="_blank">WooThemes</a> and a few for my <a title="My Plugins" href="http://www.hughlashbrooke.com/plugins/" target="_blank">personal projects</a> &#8211; and over time I have developed a standard code base from which I start any of my new plugins. I always keep this handy for any new work, so I don&#8217;t have to rewrite the same basic code every time I start something new. I&#8217;m sure many people have their own similar frameworks for this kind of thing, but I thought it worth sharing my own in case it helps someone else get started with new plugin development.</p>
<p>The template includes built-in support for:</p>
<ul>
<li><span style="line-height: 13px;">Custom post type with custom fields and custom taxonomies</span></li>
<li>Plugin settings page</li>
<li>WPML i18n</li>
</ul>
<p>The code is entirely object-oriented and is written according to the <a title="WordPress Coding Standards" href="http://codex.wordpress.org/WordPress_Coding_Standards" target="_blank">WordPress coding standards</a> &#8211; all it requires is editing in order to remove the demonstration data and add new, more functional, data. The plugin is obviously not meant to be used in its current form, but if you activate it without changing anything it will create a new post type (identified as &#8216;*Posts&#8217; in your dashboard menu) and a new settings page (found at Settings &gt; Plugin Settings). These pages are entirely functional, so you can see a working demonstration of how a plugin built using this template will work. You can get the code from GitHub below &#8211; feel free to change it to make it more practical for your own use.</p>
<a target="_blank" href="https://github.com/hlashbrooke/WordPress-Plugin-Template" class="woo-sc-button  custom" style="background:;border-color:"><span class="woo-">Get the code!</span></a>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/code-template-for-a-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Simple animated scroll for jQuery</title>
		<link>http://www.hughlashbrooke.com/simple-animated-scroll-for-jquery/</link>
		<comments>http://www.hughlashbrooke.com/simple-animated-scroll-for-jquery/#comments</comments>
		<pubDate>Thu, 28 Feb 2013 11:59:18 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[UX]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=2607</guid>
		<description><![CDATA[If you use links to navigate to other elements on the same page, it's generally a good idea to animate the scrolling so you don't disorientate your users. This snippet will make that easy for you.]]></description>
				<content:encoded><![CDATA[<p>If you use links to navigate to other elements on the same page, it&#8217;s generally a good idea to animate the scrolling so you don&#8217;t disorientate your users. There are jQuery plugins (such as <a title="jQuery ScrollTo" href="http://demos.flesler.com/jquery/scrollTo/" target="_blank">ScrollTo</a>) that offer many different ways for handling this, but if you don&#8217;t want to mess about with all the features of a new plugin then this snippet will be very useful. It&#8217;s a simple function that will scroll your page to any DOM element that you specify:</p>
<pre id="code_snippet_349" style="position:relative;width:100%;border:0;padding:0;">function scrollToElement( target ) {
    var topoffset = 30;
    var speed = 800;
    var destination = jQuery( target ).offset().top - topoffset;
    jQuery( 'html:not(:animated),body:not(:animated)' ).animate( { scrollTop: destination}, speed, function() {
        window.location.hash = target;
    });
    return false;
}</pre>
<p>As you can see you can also specify the speed and a top offset for the scroll (I find this top offset very useful as default behaviour puts the target element flush with the top of the browser, which can make things feel a bit cramped). An added bonus is that it appends the target string to the current URL, so if you are using a standard anchor reference (such as <code>#element</code>) then users will be able to grab the URL and it will point to the correct location on the page. If you are using other selectors to target an element then I would recommend removing the function inside the <code>animate</code> call.</p>
<p>You can see this function in action as the top navigation on <a href="http://www.hughlashbrooke.com">the home page of my site</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/simple-animated-scroll-for-jquery/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Totally simple jQuery method for selecting all checkboxes in a form</title>
		<link>http://www.hughlashbrooke.com/totally-simple-jquery-method-for-selecting-all-checkboxes-in-a-form/</link>
		<comments>http://www.hughlashbrooke.com/totally-simple-jquery-method-for-selecting-all-checkboxes-in-a-form/#comments</comments>
		<pubDate>Thu, 18 Oct 2012 13:33:42 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=2291</guid>
		<description><![CDATA[It's a common problem with a dozen different solutions - if you've ever needed to add a 'select all' checkbox to a form in order to make your users' lives easier then you'll have searched for a simple way to do it. If you're using jQuery here's a very simple method.]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s a common problem with a dozen different solutions &#8211; if you&#8217;ve ever needed to add a &#8216;select all&#8217; checkbox to a form in order to make your users&#8217; lives easier then you&#8217;ll have searched for a simple way to do it. If you&#8217;re using jQuery here&#8217;s a very simple method that&#8217;s as easy as can be:</p>
<pre id="code_snippet_347" style="position:relative;width:100%;border:0;padding:0;">$( '.selectall' ).click( function () {
    $( this ).closest( 'form' ).find( ':checkbox' ).attr( 'checked' , this.checked );
});</pre>
<p>You can replace the <code>form</code> identifier with whatever container you choose (<code>fieldset</code> can be useful if your form is split up like that). This code will cause all the checkboxes in the form to be toggled when you toggle any checkbox that has the <code>selectall</code> class.</p>
<p>Simple.</p>
<p>UPDATE: Modified code to be slightly more efficient as suggested by <a href="http://css-plus.com/" title="CSS-Plus" target="_blank">Jamy Golden</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/totally-simple-jquery-method-for-selecting-all-checkboxes-in-a-form/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress 101: Create a new widget area</title>
		<link>http://www.hughlashbrooke.com/wordpress-101-create-a-new-widget-area/</link>
		<comments>http://www.hughlashbrooke.com/wordpress-101-create-a-new-widget-area/#comments</comments>
		<pubDate>Mon, 30 Jul 2012 10:36:58 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Customisation]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[Widgets]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=1354</guid>
		<description><![CDATA[Most WordPress themes come with a few useful widget areas where you can place any widgets you like. Sometimes, however, you need to add your own widget area because the theme you're using doesn't quite cut it. Paste this snippet in your theme's functions.php file to create a new widget area.]]></description>
				<content:encoded><![CDATA[<p>Most WordPress themes come with a few useful widget areas where you can place any widgets you like. Sometimes, however, you need to add your own widget area because the theme you&#8217;re using doesn&#8217;t quite cut it. Paste this snippet in your theme&#8217;s functions.php file to create a new widget area:</p>
<pre id="code_snippet_343" style="position:relative;width:100%;border:0;padding:0;">function register_widget_area() {
    if( function_exists( 'register_sidebar' ) ) {
        register_sidebar( array(
            'name' =&gt; 'Widget Area Name',
            'id' =&gt; 'new_widget_area',
            'before_widget' =&gt; '&lt;div class=&quot;widget&quot;&gt;',
            'after_widget' =&gt; '&lt;/div&gt;',
            'before_title' =&gt; '&lt;h1 class=&quot;title&quot;&gt;',
            'after_title' =&gt; '&lt;/h1&gt;',
        ) );
    }
}
add_action( 'widgets_init', 'register_widget_area' );</pre>
<p>After pasting that code the new area will become available in the Appearance &gt; Widgets section of your dashboard. The options available in the snippet are pretty self-explanatory, so I won&#8217;t go through each of them &#8211; just rename the items to whatever your use case requires them to be.</p>
<p>Once you have added widgets to the new widget area, you can display them on your site easily by adding this line of code in the location that you want the widgets to appear:</p>
<pre id="code_snippet_345" style="position:relative;width:100%;border:0;padding:0;">dynamic_sidebar( 'new_widget_area' );</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/wordpress-101-create-a-new-widget-area/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Add plugin settings link to Plugins page</title>
		<link>http://www.hughlashbrooke.com/wordpress-add-plugin-settings-link-to-plugins-page/</link>
		<comments>http://www.hughlashbrooke.com/wordpress-add-plugin-settings-link-to-plugins-page/#comments</comments>
		<pubDate>Fri, 27 Jul 2012 12:09:37 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=1496</guid>
		<description><![CDATA[When building a plugin that has its own settings page, it's often handy to create a link to the settings page straight from the Plugins list - this saves users the time it takes to find where exactly your plugin appears in the admin menu. Here is a simple code snippet that creates the settings link for you - all you need to do is tell it where to go.]]></description>
				<content:encoded><![CDATA[<p>When building a plugin that has its own settings page, it&#8217;s often handy to create a link to the settings page straight from the Plugins list &#8211; this saves users the time it takes to find where exactly your plugin appears in the admin menu. Here is a simple code snippet that creates the settings link for you &#8211; all you need to do is tell it where to go:</p>
<pre id="code_snippet_341" style="position:relative;width:100%;border:0;padding:0;">function plugin_add_settings_link( $links ) {
    $settings_link = '&lt;a href=&quot;options-general.php?page=plugin_name&quot;&gt;Settings&lt;/a&gt;';
  	array_push( $links, $settings_link );
  	return $links;
}
$plugin = plugin_basename( __FILE__ );
add_filter( &quot;plugin_action_links_$plugin&quot;, 'plugin_add_settings_link' );</pre>
<p>Simply replace the <code>href</code> attribute with the link to the plugin settings page and rename the function to something slightly more unique (preferably all wrapped in an <code>if(!function_exists())</code> conditional).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/wordpress-add-plugin-settings-link-to-plugins-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some handy WordPress debugging tips</title>
		<link>http://www.hughlashbrooke.com/some-handy-wordpress-debugging-tips/</link>
		<comments>http://www.hughlashbrooke.com/some-handy-wordpress-debugging-tips/#comments</comments>
		<pubDate>Thu, 05 Jul 2012 11:17:41 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=1356</guid>
		<description><![CDATA[If something goes wrong with your WordPress install due to a faulty plugin or some bad PHP code, it can often be tricky to work out exactly what the issue is an how to fix it. Here are a couple of helpful functions and snippets that you can use to fix a number of WordPress issues.]]></description>
				<content:encoded><![CDATA[<p>If something goes wrong with your WordPress install due to a faulty plugin or some bad PHP code, it can often be tricky to work out exactly what the issue is an how to fix it. Here are a couple of helpful functions and snippets that you can use to fix a number of WordPress issues.</p>
<h3>Turn debug mode on</h3>
<p>This pretty much goes without saying &#8211; it&#8217;s the first thing you need to do as soon as something goes wrong and your WordPress site no longer loads any pages (in fact, you should always have it switched on when developing so you can be aware of PHP notices that could affect performance). When you switch debug mode on, all PHP errors, warnings and notices will be displayed in your browser. To switch it on simply open up wp-config.php in your site&#8217;s root folder, head down to line 81 and change the <code>WP_DEBUG</code> value to true:</p>
<pre id="code_snippet_329" style="position:relative;width:100%;border:0;padding:0;">define( 'WP_DEBUG', true );</pre>
<p>This should be set back to false in a live environment.</p>
<h3>Increase WordPress memory limit</h3>
<p>Often a plugin will require more memory than your default server settings allow for &#8211; with debug mode on this will result in an error that reads along the lines of &#8220;<strong>Fatal error:</strong> Allowed memory size of 33554432 bytes exhausted (tried to allocate 7680 bytes)&#8221;. To fix this you can assign WordPress more memory by adding this line to wp-config.php just below the <code>WP_DEBUG</code> line:</p>
<pre id="code_snippet_331" style="position:relative;width:100%;border:0;padding:0;">define( 'WP_MEMORY_LIMIT', '64M' );</pre>
<p>Just set the memory limit value to whatever you need it to be &#8211; the 64 used in this case should be more than sufficient for most of your needs.</p>
<h3>Prevent core script minification</h3>
<p>Core WordPress scripts and styles are minified and concatenated by default in order to get the lowest page load speed possible. This makes debugging them incredibly difficult in the case of a Javascript conflict or something similar. You can switch off this minification by enabling script debugging &#8211; just add this line to your wp-config.php file just below the <code>WP_DEBUG</code> line:</p>
<pre id="code_snippet_333" style="position:relative;width:100%;border:0;padding:0;">define( 'SCRIPT_DEBUG', true );</pre>
<p>While you can use this in a live environment, it is not recommended as it increases page load times quite a bit.</p>
<h3>Store database query data</h3>
<p>Every WordPress site makes loads of MySQL queries on each page load &#8211; most often these queries are dynamically generated and cannot easily be printed out. To remedy this you can save your queries along with backtrace data and execution time &#8211; simply add this line to your wp-config.php file just below the <code>WP_DEBUG</code> line:</p>
<pre id="code_snippet_335" style="position:relative;width:100%;border:0;padding:0;">define( 'SAVEQUERIES', true );</pre>
<p>This will store your queries (along with their relevant data) inside the <code>$wpdb-&gt;queries</code> object for easy access. This setting is not to be used inside a live environment as it can increase page load time and will potentially give people access to your database structure and data.</p>
<h3>Check if your code is actually running</h3>
<p>If you&#8217;ve added an action and for some reason it&#8217;s just not doing what it&#8217;s supposed to be doing, it&#8217;s worth doing a quick check to see if the function is actually being called &#8211; simply add a die command to the top of the function like this:</p>
<pre id="code_snippet_337" style="position:relative;width:100%;border:0;padding:0;">die();</pre>
<p>You&#8217;ll then find out very quickly if it&#8217;s working or not. This will help you work out if you&#8217;re using the wrong hook entirely or maybe just spelling the hook you want incorrectly.</p>
<h3>Deactivate all plugins</h3>
<p>If you can&#8217;t work out where the problem is coming in exactly, the best bet is to deactivate all your site&#8217;s plugins. Unless the problem is in the theme this will usually fix any issue temporarily. The process from there is to switch the plugins back on one-by-one until you find the culprit. There is a handy section on the plugins page that allows you to see a list of plugins that were recently active &#8211; this can be useful when dealing with a site that has many active and non-active plugins. To access this list just click the &#8216;Recently Active&#8217; link at the top of your plugins page.</p>
<h3>Switch to the default theme</h3>
<p>If all else fails, switching back to the default WordPress theme will show you if there are any errors in your current theme. <a href="https://twitter.com/mattyza" title="Matt Cohen" target="_blank">Matt Cohen</a> wrote a handy plugin that adds a menu to your WordPress toolbar allowing you to quickly switch between themes without having to go to the Appearance &gt; Themes page every time &#8211; you can <a href="http://wordpress.org/extend/plugins/matty-theme-quickswitch/" title="Matty Theme QuickSwitch" target="_blank">get it here</a>.</p>
<h3>Use basic PHP functions</h3>
<p>PHP has plenty of functions that are designed to help you debug your code more effectively &#8211; <code>print_r()</code>, <code>var_dump()</code> and <code>die()</code> being good examples. Get to know your PHP debugging functions as these will help you immeasurably in your development. As a side note, I find this little function is a handy replacement for <code>print_r()</code> as it shows the array in a more readable format:</p>
<pre id="code_snippet_339" style="position:relative;width:100%;border:0;padding:0;">function printr( $arr ) {
    echo &quot;&lt;pre&gt;&quot;;
    print_r( $arr );
    echo &quot;&lt;pre&gt;&quot;;
}</pre>
<h3>Google</h3>
<p>Ultimately, if you can&#8217;t find a solution to your problem them simply Google it. WordPress has such an active community that you are almost guaranteed to find a solution to your problem from a quick search of the web.</p>
<p>If you have any other quick tips for debugging WordPress please post them in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/some-handy-wordpress-debugging-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress POST data and the 404 errors: The mystery of the restricted query variables</title>
		<link>http://www.hughlashbrooke.com/wordpress-post-data-and-the-404-errors-the-mystery-of-the-restricted-query-variables/</link>
		<comments>http://www.hughlashbrooke.com/wordpress-post-data-and-the-404-errors-the-mystery-of-the-restricted-query-variables/#comments</comments>
		<pubDate>Thu, 28 Jun 2012 09:42:38 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[404]]></category>
		<category><![CDATA[Errors]]></category>
		<category><![CDATA[Query]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=1329</guid>
		<description><![CDATA[I recently had a problem with a form submitted in WordPress returning a 404 error everytime even though it was submitting to an entirely valid URL. The form submission was managed via AJAX using jQuery.post(), so at first I assumed it was a Javascript problem - after a bit of testing, however, I discovered it was happening even if I submitted the form via PHP. In the end it turned out that the problem had nothing to do with Javascript, PHP or the server configuration, but was actually due to a restriction built into WordPress that isn't immediately apparent.]]></description>
				<content:encoded><![CDATA[<p>I recently had a problem with a form submitted in WordPress returning a 404 error everytime even though it was submitting to an entirely valid URL. The form submission was managed via AJAX using <code>jQuery.post()</code>, so at first I assumed it was a Javascript problem &#8211; after a bit of testing, however, I discovered it was happening even if I submitted the form via PHP. I was entirely baffled by the issue (particularly because I had another form on the same site that submitted with no issues whatsoever) and spent a number of days trying to work it out &#8211; eventually I discovered the problem had nothing to do with Javascript, PHP or the server configuration, but was actually due to a restriction built into WordPress that isn&#8217;t immediately apparent.</p>
<p>It turns out that WordPress has a number of query variable names that are reserved for specific functions and cannot be used by any custom form on the site. In my case, I had a field called &#8216;name&#8217; that was the culprit and simply changing it to &#8216;clientname&#8217; fixed my problem entirely. The problem is that instead of giving a helpful error, WordPress just returns a 404 with no explanation about what went wrong or why it happened &#8211; even with debug mode on there is nothing helpful. This, as you can imagine, is particularly frustrating.</p>
<p>I haven&#8217;t found any official documentation listing the reserved variables, but there is <a href="http://codex.wordpress.org/WordPress_Query_Vars" title="WordPress Query Vars" target="_blank">this user-created page</a> in the WordPress Codex that has a list of them (based on the variables used by WP_Query). I&#8217;m not sure how complete it is, but it seems fairly comprehensive.</p>
<p>Seeing as though I struggled with this for a few days, I thought I would share the solution here to help anyone else who might be having a similar issue.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/wordpress-post-data-and-the-404-errors-the-mystery-of-the-restricted-query-variables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find duplicate field values in MySQL</title>
		<link>http://www.hughlashbrooke.com/find-duplicate-field-values-in-mysql/</link>
		<comments>http://www.hughlashbrooke.com/find-duplicate-field-values-in-mysql/#comments</comments>
		<pubDate>Thu, 31 May 2012 13:12:39 +0000</pubDate>
		<dc:creator>Hugh Lashbrooke</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Snippets]]></category>

		<guid isPermaLink="false">http://www.hughlashbrooke.com/?p=1229</guid>
		<description><![CDATA[I recently had to clean up a database table of user data because it had the same email addresses assigned to multiple users. The first step was putting together a query that pulled only the duplicate email addresses and also told me how many times they occurred - this simple query looked something like this.]]></description>
				<content:encoded><![CDATA[<p>I recently had to clean up a database table of user data because it had the same email addresses assigned to multiple users. The first step was putting together a query that pulled only the duplicate email addresses and also told me how many times they occurred &#8211; from there the actual clean up process was fairly straight forward.</p>
<p>This simple query looked something like this:</p>
<pre id="code_snippet_327" style="position:relative;width:100%;border:0;padding:0;">SELECT email_address, COUNT(email_address) AS occurrences
FROM users
GROUP BY email_address
HAVING occurrences &gt; 1</pre>
<p>I find this to be a particularly helpful SQL snippet as this kind of clean up process is fairly common. It uses MySQL&#8217;s <code>HAVING</code> clause because <code>WHERE</code> cannot handle aggregate functions &#8211; <code>COUNT()</code> in this case.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.hughlashbrooke.com/find-duplicate-field-values-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>