Join Morten Rand-Hendriksen for an in-depth discussion in this video Create basic HTML and CSS output, part of WordPress REST API (WP-API): First Look (2015).
- [Voiceover] You'll remember from my demo earlier…that once the plug-in is complete,…it works by adding a new button…directly under the content of single posts.…I'm going to click on that button.…AJAX kicks in,…talks with the API,…and brings out related content.…Now it's time to create that button,…because that's what everything will be based around.…In my plug-in file,…I'll create some more space at the bottom…and then I need to create two different functions.…The first one contains the HTML I want to output.…The second one grabs that HTML…and places it in the correct space…within a single post.…
So I'll start off by creating the HTML itself,…so I'll leave the comment,…// Base HTML to be added…to the bottom of a post…and here I'm going to create a function and call it…gofurther_baseline_html.…Within this function, I'll create a variable,…called $baseline…and this variable will contain the actual HTML,…so I'll test it by saying just…<div>Helooooo!</div>…and then returning the baseline variable.…
Then I have to create the function…
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