Join Morten Rand-Hendriksen for an in-depth discussion in this video How to use the exercise files, part of WordPress REST API (WP-API): First Look (2015).
- This course comes with a set of exercise files for chapter four, Building a Plug-in using the WP-API and Ajax. I've set up these exercise files to make it easy for you to follow along, as I walk through the process of building out this plug-in. When you get to chapter four, go to the course page and download the exercise files and place them somewhere on your computer, I have them here on my desktop. Inside the exercises files folder, you will find a single folder, named 04, because that's chapter 04. And within that folder, you'll find a series of folders that are the starting points for each of the individual movies within that chapter.
That means, when you get to movie, 04_03, you go to the folder with the same number, grab the file, and place it into your WordPress install, as described in that movie. For reference, I will be using a WordPress install running locally on my computer and I recommend you do the same. I'm using Wamp on my Windows computer. If you're on a Mac, you would use Mamp to do the same thing. And we have courses in the library that will show you how to do that. Called installing and running WordPress Wamp or Mamp. When I get to movie 04_03, I would go to the WP content folder in my WordPress install, then plug-ins, and that will instruct you to create a new folder for your new plug-in, and place the file from the exercise files into that folder.
Likewise as we move forward, let's say you're at 04_12, you could choose to either continue working on your own files, as you've been building them, or you can simply grab the files from the 04_12 folder and dump them into your plug-in folder in your local install. By doing this, you'll be able to follow along with exactly what I am doing. Now with that said, you can also choose to follow along from the top and write everything out yourself. I've mainly provided these exercise files to make it easy in case you're worried about making a mistake. Finally, in the exercise files folder, you'll find one folder called final result, which contains the completed plug-in.
So if you want to see how the plug-in works before you get started, you can simply grab the contents here, place them into a new folder inside the plug-ins folder and then you can run the plug-in locally on your computer before you get started.
With the WP API, developers can access the data on a WordPress site—such as users, posts, and categories—programmatically. The result is an expansion of the already limitless field of possibilities where theme and plugin development is concerned.
This course is a first look at the WP API: what it is, how to get it running, how to interact with it, what it can do for us, and what we can do with it. Join Morten Rand-Hendriksen, your guide and WordPress guru, as he walks through the tools and major features (such as routes and endpoints) of the WP API, as well as a short project that shows how this new API will be used in real-world workflows.
- Installing the WP API
- Exploring common routes
- Examining WP API output
- Building plugins with the WP API
- Crafting WP API URL requests
- Creating AJAX functions with the WP API