In rebranding the new Astute site, we chose to leverage full-site editing. It swept the Gutenberg world by storm in 2022 and continues to receive enhancements and improvements with each new release of the Gutenberg plugin. For the first time, the bulk of the construction and customization process for a theme would take place in the browser rather than in the code editor. While this sped up page composition, some templates required us to stick to traditional theme development practices where Gutenberg’s blocks didn’t fit quite our use case.

Needs Beyond the Basic Query Loop

This is present in three specific areas of the new site —

  • The category filters on the Insights page, which filter the page, and must be factored in when clicking “Load More” to fetch an additional page of posts;
  • At the bottom of each Insights post (including this one), functionality to pull a “more to read” post from the same category, ensuring it doesn’t pull the post you’re already reading;
  • At the bottom of each Work subpage, functionality to pull another subpage in the “more work” section, ensuring it doesn’t pull the page you’re already on.

In each use case, the Query Loop block would be the closest native block. However, it lacks the ability to show on-page filters to filter by category and lacks the ability to render a Load More button — it instead uses numbered pagination that requires the page to reload. And while the block can render an Insights “more to read” or Work “more work” post, it lacks the ability to detect the current category to fetch from and includes no way to ensure it will know to exclude the post you’re already reading from the query.

A number of third-party Gutenberg block suite plugins provide the functionality that we’re describing, but these offerings are needlessly expensive for what they provide, offer free versions that include intrusive upsells to the premium version, and often include much more than what we would need, cluttering up a clean back-end Dashboard. Reaching for plugins when it is not absolutely necessary is a slippery slope to poor performance and site speed, which can be a kiss of death for your organic SEO strategy.

ACF Blocks to the Rescue

We instead decided to add these functionalities using ACF Blocks, and writing the rest of the templates using Reusable Blocks. We also decided to leverage ACF Blocks in sections of the back end where we felt that the full-site editing experience in Gutenberg was more troublesome than the field-based experience many are used to — including the spinning diagram and quotes slider on the Services page and the retro animation on the Error 404 page. On other client sites, we’ve felt the same way when constructing meganavs, as the full-site editor lacks the functionality to embed anything but navigation items in a Navigation block, and doesn’t support full-width subnavs.

The decision to use ACF Blocks did slightly increase the amount of PHP we used, both in registering the block in functions.php, as well as the syntax for the block itself — but we’ll be using alternative methods in the future to keep this at a minimum. The queries needed for Insights and Work were written in PHP, but just as easily could’ve used JavaScript and the REST API to create a hybrid theme.

Overall, the amount of PHP WordPress is shipping in their own default themes saw a stark decline heading into 2023 —

  • twentytwentyone ships 48 PHP files, including normal page templates, functions.php, and for all of its full-site editor template parts;
  • twentytwentytwo ships 69 PHP files, all but two (an empty-but-still-required index.php and functions.php) in the form of block patterns;
  • twentytwentythree ships just six PHP files, all block patterns, and includes no index.php or functions.php, the latter replaced entirely by theme.json.

The informal mantra of our internal development efforts for 2023 is to write as little PHP as possible, instead leveraging full-site editing, ACF Blocks, the WordPress API, and a healthy dose of JavaScript. Through the continuing maturation of Gutenberg, this mantra is looking very achievable.

While the initial advent of the WordPress API led to accusations that WordPress is ditching PHP for JavaScript, that is not expected anytime soon for WordPress Core. However, it’s looking more and more like the future of theme development, as JSON becomes the brains of theme building, and full-site editing is the body, and also the beauty, and also the brawn, and also sometimes the brains.

The Takeaway

For marketing sites, full-site editing is a paradigm shift for site composition, satisfying 99% of our use cases. For that remaining 1%, it’s still possible to achieve goals without turning to bloated plugins or completely back to traditional PHP template development. Specifically, filling the gaps using the WordPress API makes creating hybrid themes an attractive option that minimizes most of the need for PHP. We expect less PHP in our /wp-content/ folders in 2023, as headwinds cause JSON to further supplant PHP. These are all welcome changes.