Join Morten Rand-Hendriksen for an in-depth discussion in this video How to use the exercise files, part of WordPress: REST API.
- [Instructor] To make it easier to follow along, this course comes packaged with exercise files. You can download them directly from the course page onto your computer. Depending on what chapter you're in, the exercise files will work a little bit differently. So, chapters three and four have exercise files that contain a WordPress child theme that you add into a locally installed version of WordPress on your computer. We'll be working with this child theme and expanding it and you can either follow along in the movie or you can just pull down the files that are in the exercise files for each of the movies.
You'll notice that these files are marked 03_02 for chapter three, movie number two and 04_03 for chapter four, movie number three etc. etc. In some rare cases, you'll find a folder named something like 04_11_end. That means that in movie 04_11 we made some changes and I'm providing you with those changes in a separate folder, so that you can see what I did and match it up to your own code. When we get to chapter five, we'll be working with a standalone application that runs on your computer. In this chapter, you can simply go into the folders for the movie you are currently watching, grab the folder inside called wp-reader and just place it somewhere on your computer, for example, on your desktop.
We'll be working within that folder and as we move forward, we'll be adding more features to it, so you can either grab the exercise files for each movie as we move along or follow along in the movie and type out your own code. It's entirely up to you. Finally, there's a folder called Assets that I'll refer to early on in the course. It contains a single file, a collection that will be appended to an application called Postmen that we'll install a little later on. This is the only asset that ships with the course and it's kind of standalone and separate from a specific movie, that's why it's sitting in its own Assets folder.
So, before you continue watching the course, go grab the exercise files, place them somewhere on your computer and then we can get started.
- Using a REST client to communicate with a REST API
- Reviewing available routes, endpoints, and arguments
- Adding custom post types and taxonomies
- Altering the API response
- Using PHP for resiliency
- Passing info using wp_localize_script()
- Setting up a REST API request through AJAX
- Outputting selected post data to the front end
- Formatting post data to match a theme
- Triggering AJAX for an infinite scroll effect
- Using AJAX to load subsequent responses