Back

Supertheme — WordPress on Symfony components

A WordPress starter theme built on Symfony components: DI container, YAML config, Twig, tests and CI. The base for an agency's 2016 client builds.

Role
Author
When
Mar 2016 – Dec 2016
Client
Seattle WordPress agency
WordPressSymfony componentsTwig / TimberComposerPHPUnitGulp

Supertheme is a WordPress starter theme I designed and built for a Seattle WordPress agency with a steady stream of client sites. It brought the habits of a Symfony project into WordPress, and became the starting point for the agency's client builds through 2016.

What I built

  • Symfony's DependencyInjection container at the core, so services such as logging, sessions and translation are configured and injected rather than scattered through functions.php.
  • YAML configuration for the tedious parts of a theme: scripts, styles, menus, sidebars, image sizes and theme support. A new site starts by editing config, not by copying code.
  • Twig templating through Timber, keeping markup out of PHP, plus custom menu walkers for drop-down, drill-down and accordion navigation.
  • Symfony components for the rest: HttpFoundation sessions, Translation, Filesystem, and Monolog for logging.
  • An ACF-driven theme options page for analytics, sharing and footer settings, so editors don't need a developer for routine changes.
  • A Gulp asset pipeline for Sass, script bundling, image optimization and sprites, with debug builds alongside minified ones.

Treated like a product

It was installed with Composer, published on Packagist under the MIT license, and released with semantic versions and a changelog up to 2.0.0. It had PHPUnit and Travis CI from the start, with PHP_CodeSniffer for a consistent style, because a base theme that every new site starts from is worth the same care as the sites themselves.