~/talk

Build a Theme with the REST API

Talkat WordCamp US 2015 · 2015-12-04..12-06· [wordpress, frontend-architecture]
links:none on file
slides:none on file

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

  1. 0:00Start
  2. 0:07Why Would You Build a Theme This Way?
  3. 1:30Requirements
  4. 1:58Scripts Used
  5. 3:15Theme Structure
  6. 3:43Main Template Scaffold index.php
  7. 4:48Load Scripts
  8. 6:49Define Variables & Click Handler for Logo
  9. 12:26Determine Paged Location from Posts Response & Pass Pagination to Underscore Template
  10. 13:49Display Pagination Navigation index.php
  11. 14:52Add Underscore Template index.php
  12. 16:13Fetch a Single Post Response with Embedded Data & Pass All Data to the Underscore Template
  13. 17:59Display Single Post with Related Data from Response
  14. 19:30Resources
~/search
type to search 6,518 conferences, 143,918 speakers and 192,133 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.