On the command line shell, there is a magic symbol “-” (hyphen). When dealing with streams, it can refer to STDIN or STDOUT. When used in the context of the cd command, the – refers to the previous directory (it is the same as $OLDPWD). So you can switch between two directories by repeatedly entering … Continue reading Referring to the Previous Git Commit
Check out The Definitive Guide To PHP’s
empty() for a deep dive on these faux-function language constructs.
- always develop with error reporting turned to 11 (and fix all real errors)
- always use
isset for variables that may legitimately not exist
- never use
isset for variables that should exist
Note: To deal with PHP notices in 3rd-party code, if you can’t contribute fixes upstream you may want to consider using a plugin like Zack Tollman’s Ostrichcize.
it [is] impossible to distinguish between a variable that does not exist and a variable that has the value
null. […] Specifically for arrays, there’s an alternative to
array_key_exists. This function specifically does what it says: it returns
true if an array key exists, regardless of the value of that key. That makes it possible to detect
null values in arrays
array_key_exists() is used in
WP_Customize_Manager::post_value() for this reason. Since the Customizer’s dirty setting values are encoded as JSON it is possible for a post value to be
wp.customize.Value doesn’t directly facilitate
seting this value).
Some great merits of keeping changelogs along with some best practices for managing them: Keep a Changelog.
We use Varying Vagrant Vagrants (VVV) as the development environment for as many projects as we can. It provides a great foundation not only for developing client projects but also for core development itself.
Continue reading Running PHPUnit Tests Outside VVV
We often do bi-weekly sprint iteration demos for our client projects. In these demos, we get the chance to showcase the work we’ve done over the past couple weeks.
Continue reading Creating Project Demo Screencasts
When committing to SVN, “there is no reset button”. You cannot purge the memory of a commit once it has been made in an SVN repo (e.g. a theme on WordPress.com VIP, a plugin in the WordPress.org directory, or even especially WordPress core at develop.svn.wordpress.org). That is, in SVN there is no commit amending, hard … Continue reading Sanity check pre-commit hook for SVN
As seen previously on this blog, in Contributing to WordPress Core via GitHub and Streamlining Contributions to WordPress Core via GitHub, there are instructions for how to get a Git repo set up for committing patches for WordPress Core. These posts also include instructions for how to set up Travis CI to restrict reporting linting errors to just the scope of the changed lines … Continue reading Git pre-commit hook for WordPress development
Update 2017-01-03: This post and associated plugins have been updated for WordPress 4.7. There’s a lot of excitement in the WordPress community about the WP REST API. We’ll be sending a couple representatives to the Day of REST conference coming up at the end of January, and I’ve been long-overdue to do a deep-dive in to the REST … Continue reading Bridging the Customizer and the WP REST API
A couple months ago at WordCamp Portland, I gave a talk on “The Impact of the Customizer”: The Customizer is WordPress’s framework for live previewing changes to a site. Live preview gives confidence to those who would otherwise lack it when making a change: it gives freedom to experiment and explore, without a negative “save … Continue reading The Impact of the Customizer at WCPDX
To make the Customizer a great user experience, themes and plugins should implement settings that use the postMessage transport as much as possible. By default, settings get registered with a refresh transport meaning that every change to that setting will trigger a refresh in the preview so that PHP can re-render the preview with the … Continue reading Implementing Selective Refresh in the Customizer