Jack Lenox on Building Themes with the WP REST API

WordCamp London 2015 was packed full of excellent presentations, lightning talks, and panels. For several of the more technical sessions, attendees were actually turned away at the door due to the rooms being filled to capacity. This was the case for Jack Lenox’s presentation on Building Themes with the WP REST API.

“I was overwhelmed by the popularity of the talk,” Lenox said in his recap post. “I think there were over 200 people crammed into the room, and many more ended up getting turned away.” A photo captured just before the session shows how crowded the room was with attendees eager to learn about building themes with the WP REST API.

photo credit: Tim Nash
photo credit: Tim Nash

When asked for a link to his slides, Lenox found that they didn’t communicate much on their own without the presentation, a common drawback to viewing the slides by themselves. The session should make it onto WordPress.tv sometime soon, but in the meantime he created a screencast for those who couldn’t attend.

The video is actually an extended edition of his talk and runs for a full 50 minutes. Lenox starts by answering the question, “What’s the big deal about the REST API?” He also demos the speed of getting content from the API using a few live examples.

His presentation offers theme developers a few reasons for why they may want to look into building themes that use the WP REST API:

  • Provides a way to retrieve pure data (usually in JSON or XML format) over HTTP
  • No loops necessary
  • Good for mobile apps and environments where you don’t want a full webpage to render but want content from a blog or site

Lenox gives a basic overview of what can you do with the WP REST API, even without knowing any PHP. The benefits he cites include a more engaging user experience, potentially reduced server load, improved speed, and better control over failed connections. During the presentation he shows examples of how to incorporate single page application elements into WordPress themes where interactions are handled by JavaScript.

The Picard theme that he demos is aptly named as a play on the next generation of themes. It’s a prototype WordPress theme built with React and the upcoming WP-API. If you want to play with it, you can clone the repository on GitHub. Automattic is aiming to open source the Picard theme around the beginning of May.

Interest surrounding the presentation demonstrates how excited the WordPress community is to start incorporating the new API into their projects. Many who attended the session at WordCamp London were inspired to start looking at themes in a new way.

The resulting experience of pre-loading all the content allows users to zip around without any delay. It’s a dramatic improvement and an amazing example of how a theme can have much more control over the speed and resources needed to present content on the frontend. If your interest is piqued, check out Jack Lenox’s extended edition video for the full technical breakdown.

3 Comments


  1. This is exactly the sort of information I was looking for with regards to the new WP REST API. A lot of focus has been on its use in applications so far. I was always wondering whether / how it could be used effectively for theming purposes.

    Very interesting.

    Report


  2. I was lucky enough to make it into the room for Jack’s talk (far top-right of the photo) and have to say it was one of my favourite talks of the whole weekend. Jack explains how themes can take advantage of the new API using Facebook’s React library. If you didn’t manage to catch the talk in person, then the video is a must watch!

    Report

Comments are closed.