WordPress powers over 25% of the Internet, with its easy to use admin interface it is a great way to power the content of any site, or application. However powering applications (native or not) was challenging, till the WordPress REST API was introduced. I will walk through why and how to use the WordPress REST API to build angular applications.
2. Sr. Software Engineer | The Walt Disney Company
Roy Sivan Twitter/Github - @royboy789 roysivan.com | thewpcrowd.com
WHO IS THIS GEEK?
• Teach @ Lynda.com
• Teach @ CalderaLearn.com
• Podcast @ AiA & JavaScriptJabber
• Blog / Podcast @TheWPCrowd.com
• Blog @ RoySivan.com
@royboy789
3. WHAT WE ARE GOING TO COVER
• WordPress? Seriously?
• Why build with WordPress
• Cats
• How to build with WordPress
22. OUT OF THE BOX AMAZING SAUCE
• /wp-json/ - prefix for ALL routes
• /wp/v2/ - namespace for default routes
• /posts
/pages
/comments
/categories
/taxonomies
@royboy789
27. CUSTOM ROUTES
Customizing or adding to routes is easy
1. Define a new namespace
2. Define your route and callback
3. Return a WP_REST_RESPONSE object with your data
@royboy789
30. @royboy789
CUSTOM ROUTES - EXAMPLE
function create_manual_commission_init( WP_REST_Request $request ) {
// Get Params from Request
$request_data = $request->get_params();
// Create Response Object with data
$response = new WP_REST_Response( $request_data );
// return response
return $response;
}
31. USE CASES
• Ionic / NativeScript Native App
• Decoupled applications that utilize WordPress content
• Decoupled apps which interact with a WordPress site
• Micro widgets for other websites
Roy Sivan Twitter/Github - @royboy789 roysivan.com | thewpcrowd.com
32. NO BUT SERIOUSLY… WORDPRESS?
• WordPress isn’t your grandma’s blog CMS
anymore
• RESTful API is easy to customize and add to
• You can still build what you want, with the
code you want
Roy Sivan Twitter/Github - @royboy789 roysivan.com | thewpcrowd.com
33. AWESOME RESOURCES
• Lynda.com - find me!
• Caldera Learn - check outYouTube
• developer.wordpress.org/rest-api - docs, etc.
• LoopConf - A dev focused WP Conference
• TheWPCrowd.com
Roy Sivan Twitter/Github - @royboy789 roysivan.com | thewpcrowd.com
34. THANK YOU
FIND ME ONLINE:
@royboy789
Roy Sivan Twitter/Github - @royboy789 roysivan.com | arcctrl.com