Build a Theme with the REST API
summary
Shows a working theme that uses almost no PHP, running on WordPress 4.4 plus the WP REST API v2 plugin, with assets enqueued in functions.php and a single index.php template. Client-side uses jQuery, underscore.js templates and director routing to fetch posts from /wp-json/wp/v2/posts, render lists with Next/Previous using the X-WP-TotalPages header, and show single posts with _embed for author and featured media. The demo works, is cacheable with Varnish, and recommends JS fallbacks for SEO.
AI-written summary · about
chapters (14)
- 0:00Start
- 0:07Why Would You Build a Theme This Way?
- 1:30Requirements
- 1:58Scripts Used
- 3:15Theme Structure
- 3:43Main Template Scaffold index.php
- 4:48Load Scripts
- 6:49Define Variables & Click Handler for Logo
- 12:26Determine Paged Location from Posts Response & Pass Pagination to Underscore Template
- 13:49Display Pagination Navigation index.php
- 14:52Add Underscore Template index.php
- 16:13Fetch a Single Post Response with Embedded Data & Pass All Data to the Underscore Template
- 17:59Display Single Post with Related Data from Response
- 19:30Resources
