This week: Full Site Editing, the power of Block Patterns, working in XWP, DevRel, and much more.
A decade ago, Leon created the WP2Static plugin to solve the security and performance issues inherent with a dynamic web app like WordPress.
This experience led to recruitment into the expert team at Strattic, leaders in the WordPress static publishing space.
WordPress developers aren’t famous for their code quality and we’re all paying for it!
The extensibility of WordPress and low barrier of entry for developers to build with it have led to the mass adoption we see today. What we don’t see when we visit a typical WordPress site, is the low quality code in some of the 50+ installed plugins or the site’s theme. We don’t see it, but we can often feel it in slow loading or buggy pages. The site owner may feel it in their wallet, paying for more powerful servers to run their increasingly bloated sites.
It is thus, up to us, as WordPress developers, to adopt code quality measures in our plugins and themes. Not only for the great performance and security benefits it provides our users, but by also catching bugs early in development. This gives us confidence that our software behaves as we expect. So, we’ll have less support requests, more sales and a better night’s sleep!
PHP Code Sniffer can be run manually, in a build process or automatically within your code editor to alert you of coding standard violations. There are a bunch of popular coding standard rulesets defined which you can choose to adhere to, such as the official WordPress Coding Standards. I prefer the standard in Viktor’s PSR 12 Neutron Hybrid Ruleset.
Where PHPCS analyses each file individually, for obvious syntactical issues, PHPStan goes much deeper. PHPStan will load your classes and report things like namespace violations, trying to call functions with incorrect arguments and many more useful tests. PHPStan can be run with varying levels of strictness. While I started with something midway, I almost immediately set it to the strictest checking – I mean, who wants OK quality when you can have great quality, amirite? PHPStan will look at your PHPDocs to see what a function’s argument type is, then alert you if anywhere in your code, you could possibly call it with an unsupported type of variable. This is so powerful and can shut down a whole range of bugs and security issues before they have a chance to do damage!
PHPUnit is a unit testing framework, which, like many others, derives structure and behaviour from the Smalltalk languages’s SUnit framework (TIL!). Unlike PHPCS and PHPStan, you can’t just install it, set some config options and immediately benefit from it telling you all the coding mistakes you’ve made. With PHPUnit, you’ll need to write your own tests. Yeah, so the least appealing to the lazy developer in us!
Once you get started with unit testing though, you won’t want to write code without it. Or you will, then curse yourself when a bug is reported that you know you could have avoided, had you written unit tests!
You’ll find more information about code quality tools in this article.
Part 1 of Full Site Editing 101 has appeared on metabox.io. If you want to create a theme with FSE, then this tutorial is an ideal starting point.
Max Denysenko perfectly described how hooks work in WordPress. Admittedly, this is probably one of the most comprehensive articles on the topic.
Chris Wiegman has expressed his thoughts on the progressing complexity of the WP ecosystem in recent years.
Referring to Chris’ article, Jeff Chandler highlights the importance of learn.wordpress.org to everyone.
Tammie Lister explains the power of Block Patterns.
Pascal Birchler described how video optimization works in the Web Stories for WordPress plugin.
Stéphane Boisvert lists ten reasons why working at XWP is worthwhile. His article could also serve as a benchmark for other companies as everyone would prefer to work in one that lives up to these expectations.
Alex Standiford has come up with an attractive concept for building nearly headless websites. Additionally, he plans to start a course presenting how it works in detail.
I very much like how the WooBuilder Blocks plugin lets you reimagine the look of a product page.
Tara King announced on Twitter that she had become head of the Developer Relations Team at Automattic with her main tasks related to Gutenberg and Full Site Editing.
Ross Wintle has just published a series of articles on what he learned about being a freelancer in ten years.
Konstantin Kovshenin shows how to create a WordPress cache plugin from scratch.
Rich Tabor has just forged a very nice plugin for creating checklists visible only in Gutenberg.
Kinsta has published a tool enabling easy identification of the theme used on a website and the key info about it.
A compelling article revealing why the creators of Font Awesome started using Figma.
Upcoming Events:
On August 5, 10, 12, and 17, another Yoast Summer School workshop will be held.
WordPress.com Growth Summit 2021 will take place on August 17-18.
On 31st August Buddy is doing a webinar about Creating the perfect flow for your WP apps together with Kinsta and Osom Studio.
WPMRR Virtual Summit, a conference devoted to earning through WordPress, is scheduled to take place on September 21-23.