Bradley Kirby released version 1.0 of his Wallace WordPress theme today. The theme is built using the WP REST API and Angular 2. Kirby has been working on Wallace for the past two years and has rewritten it several times in order to keep pace with changes in the REST API and Angular.
“It really opens a whole new world of possibility for WordPress themes,” Kirby said. “For this release I’ve primarily focused on smooth page transitions. That’s just not possible with the traditional server-rendered themes. But I think there’s a lot of really cool customization techniques that the API allows for, too. That’s what I’m hoping to explore next.”
“I really like the prescriptive nature of Angular,” Kirby said. “There’s a ‘right’ way to do things that you’ll find in example projects and all the functionality comes with the framework itself. With React you have to use a collection of third-party libraries with various maintainers. With Angular, it’s all Google, and all one repository. I think React is a perfectly fine framework, and they actually share a lot of concepts.”
Wallace currently only supports posts, but Kirby plans to implement more core WordPress features, including pages, comments, searching, and category filtering. He said those features shouldn’t be too difficult to implement now that the frame is there.
“From a programming perspective, this was way more difficult to create than a PHP-rendered theme, because you get so much ‘for free’ with the PHP theming API that you don’t get when you’re just making raw requests to the REST API,” Kirby said. The primary advantage of theming with the API is more instantaneous interactions with the content, but creating API-driven themes is not yet as easy as the old way of theming.
Kirby said he is actively exploring the idea of submitting Wallace to WordPress.org, but the Theme Review Team does not permit the use of Twig templates.
“I’ve brought it up with the team that approves themes, and they didn’t like that I was using the Twig templating library on the PHP side,” Kirby said. “So I’d have to maintain two versions of the theme if I were to submit it to the directory.” Kirby hasn’t ruled it out yet and said he will probably revisit the idea next year.
“Twig templates mirror Angular templates really nicely,” Kirby said. “It cuts down on the maintenance burden quite a bit, because I have to exactly mirror the templates on the server side and the client side. That would be more difficult if I had to construct PHP echo strings, the typical WordPress template way.”
The next items on Wallace’s roadmap are adding more core features into the theme. Kirby said he is also exploring the idea of creating a commercial magazine theme in the future.
“I think the real killer use case for this way of developing themes is e-commerce, but I want to get a good solid magazine style premium theme done before I tackle that,” Kirby said.