Slide 1

Slide 1 text

WP REST API And the REST is simple* Reuven Karasik *This pun is good because it’s so bad.

Slide 2

Slide 2 text

Who am I? • Reuven Karasik • Learned HTML when I was 7 • Using WordPress since version ~ 3 • An entrepreneur, leading Made in Jerusalem’s Youth Community • Lead Front End developer for Chiprix and Crayze • Don’t really go to school • Just turned 16

Slide 3

Slide 3 text

Technologies

Slide 4

Slide 4 text

What is the WordPress RESTful API?

Slide 5

Slide 5 text

The WordPress Loop in PHP

Slide 6

Slide 6 text

The ng-repeat loop with Angular

Slide 7

Slide 7 text

Why REST and not the rest?* *I’m really sorry, I can’t help it. Maybe I need some rest. • Cleaner Code • Faster Page Loads • Automatic Filters • No PHP knowledge needed • Angular is awesome

Slide 8

Slide 8 text

What is the WordPress RESTful API?

Slide 9

Slide 9 text

What is the WordPress RESTful API?

Slide 10

Slide 10 text

What is the WordPress RESTful API?

Slide 11

Slide 11 text

When AngularJS kicks in

Slide 12

Slide 12 text

Let’s get coding! 1. Simple WordPress theme with static HTML 2. Include AngularJS and create the app 3. Use $http.get() to get all the posts 4. Turn the static HTML into ng-repeat loop 5. Make some static content become dynamic 6. Add a thumbnail with a PHP trick 7. Add HTML Sanitization

Slide 13

Slide 13 text

Steps forward: 1. Add navigation, different pages with ng-route 2. URLs and permalinks 3. 404 and other error pages 4. Working with Custom Post Types, Custom Fields etc. 5. Learn Angular 2.0!

Slide 14

Slide 14 text

Resources: • http://v2.wp-api.org/ - Official Documentation • https://1fix.io/angularjs-wp-rest-api/ - Amazing Tutorials • http://goo.gl/2y27I4 - Tuts+ Introduction Article • http://github.com/kinging123/tardis - Full Code From Today • https://github.com/1fixdotio/angularjs-demo-theme/ - Ready Theme

Slide 15

Slide 15 text

Thanks for listening! Any questions?

Slide 16

Slide 16 text

Reuven Karasik
 [email protected]
 Friend me on Facebook!