Building WordPress sites with AngularJS and the RESTful plugin JSON API @ DevLink 2014

Eric Greene
Eric GreeneIndependent IT Trainer & Software Developer at Independent Professional
Building WordPress sites with 
AngularJS and the RESTful 
plugin JSON API 
DevLink 2014 
By: Eric W. Greene 
http://www.ericwgreene.com 
@ericwgreene
Introduction 
Web Development is Changing… 
• Modern web development 
• Less Server Platform (PHP, Java, .NET) 
• More Web Browser Platform (HTML/CSS/JavaScript) 
• Modern web applications 
• Web server is a repository of user interface templates (HTML, CSS, 
JS resources) and it provides access to data 
• Binding of templates and data is handled through JavaScript 
frameworks on the web browser 
• Navigating from page to page is handled by Web Browser based 
JavaScript routing systems that do not involve reloading the entire 
page from the server 
• Web browsers use AJAX to send/receive data to/from RESTful 
services provided by the web server
Introduction 
Why is Web Development Changing? 
• Web browsers and client devices are becoming more capable 
• Devices in general (desktops, laptops, tablets, phones) are very 
powerful 
• Web browsers are emerging as a true platform 
• Chromebooks, Chrome Store 
• Web technology is being used to construct UIs for traditional apps 
• PhoneGap 
• Windows 8 Apps 
• JavaScript on the Server - Node.JS 
• Used for development and development tooling 
• More and more libraries being created 
• Because JavaScript is being used everywhere, developers in general 
increasingly want to use in the browser
Introduction 
How does this Web Development Change Benefit Users? 
• Pushing more code to the browser results in application called Single 
Web Page Applications more commonly called Single Page 
Applications or simply SPAs 
• How do users benefit from SPAs? 
• SPAs in general are more functional (without a page reload) and 
behave more like desktop apps 
• In a high network latency environment, a well written SPA can 
continue to perform acceptably for the user 
• Example: Marriott and Conference Center Internet 
• Many SPAs can operate in offline mode allow the user to use the web 
application even when disconnect then when they connect again 
everything gets synced up
Introduction 
WordPress (and other Content Management Systems) 
• When people think WordPress, they think blogging software 
• But really, WordPress is so much more… Truly, its a very powerful, 
extensible and capable Content Management System 
• WordPress has been around for a long time, is well tested, well 
supported by a huge community of bloggers, developers, plugin & 
theme providers 
• WordPress is a great tool but it was also developed in an earlier time 
when web applications were more server-driven and less browser-driven 
• Out of the box 
• WordPress relies upon the server for all processing of the user 
interface 
• Real JavaScript functionality is limited
Introduction 
Transforming WordPress 
• WordPress does not have to be limited to older server-driven 
techniques 
• To bring WordPress into the next generation of web apps 
• Create themes that leverage the power of JavaScript libraries such 
as KnockoutJS, EmberJS and AngularJS. 
• Employ plugins which provides RESTful services that provide access 
to core WordPress data 
• Up and coming - WP REST API - new RESTful API for WordPress 
• The result 
• Blogs and websites which perform better with the latest 
development technologies
Using AngularJS 
Why AngularJS? 
• AngularJS is a complete framework for building Single Page 
Applications 
• Using the MVC pattern, it can manage your models and views 
including routing to different views 
• Supports two-way data binding allow easy data collection via forms 
• Provide directives to build complex reusable UI components that 
integrate nicely into your application 
• Provides an excellent mocking library so you can follow test-driven 
development principles and really write unit tests for your code 
before implementation 
• Allows for the creation of cross cutting services that can provide 
useful functionality throughout your application 
• AngularJS is the current hot web development technology - everyone 
from small shops to very large corporations are embracing it
Introduction 
Goals for Today… 
• Inform you of the changing landscape of web development with 
WordPress (or really any other web development platform) 
• Demonstrate one of the many technologies changing web 
development today, AngularJS within the context of WordPress 
• Persuade you to focus less on the server and embrace JavaScript (and 
its many frameworks) and the Web Browser (as a true platform not 
just a viewer) for sophisticated and powerful web applications
Let’s Get Started… 
What we will cover 
• Starting with a clean copy of WordPress 
• Create a new theme 
• Add AngularJS to the theme 
• On the blog home page, replace the usual list of blog entries with an 
AngularJS powered list 
• Install the RESTful JSON API Plugin 
• Use AngularJS to display a specific blog entry 
• Refactor original blog post listing to use JSON API and 
angular.ForEach 
• Clean up routing URLs using HTML 5 Mode 
• Move Module to External JS File
Thank You for Attending! 
Some Good AngularJS Resources 
• Some good resources for learning more about AngularJS 
• Pro AngularJS from APress 
(http://www.apress.com/9781430264484) 
• Ng-Book (https://www.ng-book.com/) 
• WintellectNow Training Videos 
(https://www.wintellectnow.com/Videos/Index?searchString=Angul 
arJS) 
• Accelebrate, Inc. On-site Training (http://www.accelebrate.com/) 
• WordPress REST API (instead of the JSON API Plugin) 
• http://wp-api.org/ 
• Download Today’s Demos 
• https://github.com/ericwgreene/wordpress-angularjs-jsonapi 
• Includes all source code and PDF of slide deck
1 of 10

Recommended

Building WordPress sites with AngularJS and the RESTful plugin JSON API by
Building WordPress sites with AngularJS and the RESTful plugin JSON APIBuilding WordPress sites with AngularJS and the RESTful plugin JSON API
Building WordPress sites with AngularJS and the RESTful plugin JSON APIEric Greene
1.2K views6 slides
Using MAMP for Web Development by
Using MAMP for Web DevelopmentUsing MAMP for Web Development
Using MAMP for Web DevelopmentEric Greene
3.7K views19 slides
Getting SEO performance in Angular Meteor with ngmeta by
Getting SEO performance in Angular Meteor with ngmetaGetting SEO performance in Angular Meteor with ngmeta
Getting SEO performance in Angular Meteor with ngmetaWill Haire
654 views33 slides
Welcome to the World of WordPress by
Welcome to the World of WordPressWelcome to the World of WordPress
Welcome to the World of WordPressContent Connects, Nashville
1.8K views14 slides
Multisite core concepts final by
Multisite core concepts finalMultisite core concepts final
Multisite core concepts finalUmesh Chaudhary
815 views29 slides
Javascript & Jquery by
Javascript & JqueryJavascript & Jquery
Javascript & JqueryGurpreet singh
228 views12 slides

More Related Content

What's hot

Single page applications by
Single page applicationsSingle page applications
Single page applicationsPrafful Garg
1.1K views8 slides
Moving from PHP to a nodejs full stack CMS by
Moving from PHP to a nodejs full stack CMSMoving from PHP to a nodejs full stack CMS
Moving from PHP to a nodejs full stack CMSMake & Build
3K views21 slides
Using WordPress as a Headless CMS by
Using WordPress as a Headless CMSUsing WordPress as a Headless CMS
Using WordPress as a Headless CMSAdam Rasheed
712 views19 slides
Learning Single page Application chapter 1 by
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1Puguh Rismadi
684 views24 slides
Single Page Application by
Single Page ApplicationSingle Page Application
Single Page ApplicationIsuru Madusanka
1.3K views24 slides
Introduction To Single Page Application by
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page ApplicationKMS Technology
10.8K views34 slides

What's hot(20)

Single page applications by Prafful Garg
Single page applicationsSingle page applications
Single page applications
Prafful Garg1.1K views
Moving from PHP to a nodejs full stack CMS by Make & Build
Moving from PHP to a nodejs full stack CMSMoving from PHP to a nodejs full stack CMS
Moving from PHP to a nodejs full stack CMS
Make & Build3K views
Using WordPress as a Headless CMS by Adam Rasheed
Using WordPress as a Headless CMSUsing WordPress as a Headless CMS
Using WordPress as a Headless CMS
Adam Rasheed712 views
Learning Single page Application chapter 1 by Puguh Rismadi
Learning Single page Application chapter 1Learning Single page Application chapter 1
Learning Single page Application chapter 1
Puguh Rismadi684 views
Introduction To Single Page Application by KMS Technology
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology10.8K views
Web development using ASP.NET MVC by Adil Mughal
Web development using ASP.NET MVC Web development using ASP.NET MVC
Web development using ASP.NET MVC
Adil Mughal6.6K views
Rise of the responsive single page application by Oren Shatken
Rise of the responsive single page applicationRise of the responsive single page application
Rise of the responsive single page application
Oren Shatken4.8K views
Single page application and Framework by Chandrasekar G
Single page application and FrameworkSingle page application and Framework
Single page application and Framework
Chandrasekar G624 views
Iseltech17 - Single Page Applications by Monica Rodrigues
Iseltech17 - Single Page ApplicationsIseltech17 - Single Page Applications
Iseltech17 - Single Page Applications
Monica Rodrigues747 views
I Can Haz More Performanz? by Andy Melichar
I Can Haz More Performanz?I Can Haz More Performanz?
I Can Haz More Performanz?
Andy Melichar2.2K views
Single page application by Arthur Fung
Single page applicationSingle page application
Single page application
Arthur Fung915 views
An introduction to wordpress by Crack Aloud
An introduction to wordpressAn introduction to wordpress
An introduction to wordpress
Crack Aloud99 views
Making Single Page Applications (SPA) faster by Boris Livshutz
Making Single Page Applications (SPA) faster Making Single Page Applications (SPA) faster
Making Single Page Applications (SPA) faster
Boris Livshutz1.9K views
Back to the Basics - 1 - Introduction to Web Development by Clint LaForest
Back to the Basics - 1 - Introduction to Web DevelopmentBack to the Basics - 1 - Introduction to Web Development
Back to the Basics - 1 - Introduction to Web Development
Clint LaForest1.7K views
Build fast word press site in react in 30 mins with frontity by Imran Sayed
Build fast word press site in react in 30 mins   with frontityBuild fast word press site in react in 30 mins   with frontity
Build fast word press site in react in 30 mins with frontity
Imran Sayed104 views

Similar to Building WordPress sites with AngularJS and the RESTful plugin JSON API @ DevLink 2014

Intro to SPA using JavaScript & ASP.NET by
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NETAlan Hecht
8.2K views47 slides
Top 10 frameworks of node js by
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node jsHabilelabs
204 views16 slides
Building Enterprise Grade Front-End Applications with JavaScript Frameworks by
Building Enterprise Grade Front-End Applications with JavaScript FrameworksBuilding Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript FrameworksFITC
2K views77 slides
Build Modern Web Apps Using ASP.NET Web API and AngularJS by
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJSTaiseer Joudeh
3.8K views15 slides
Introduction to Web Frameworks by
Introduction to Web FrameworksIntroduction to Web Frameworks
Introduction to Web FrameworksSarika Jadhav
81 views19 slides

Similar to Building WordPress sites with AngularJS and the RESTful plugin JSON API @ DevLink 2014(20)

Intro to SPA using JavaScript & ASP.NET by Alan Hecht
Intro to SPA using JavaScript & ASP.NETIntro to SPA using JavaScript & ASP.NET
Intro to SPA using JavaScript & ASP.NET
Alan Hecht8.2K views
Top 10 frameworks of node js by Habilelabs
Top 10 frameworks of node jsTop 10 frameworks of node js
Top 10 frameworks of node js
Habilelabs204 views
Building Enterprise Grade Front-End Applications with JavaScript Frameworks by FITC
Building Enterprise Grade Front-End Applications with JavaScript FrameworksBuilding Enterprise Grade Front-End Applications with JavaScript Frameworks
Building Enterprise Grade Front-End Applications with JavaScript Frameworks
FITC2K views
Build Modern Web Apps Using ASP.NET Web API and AngularJS by Taiseer Joudeh
Build Modern Web Apps Using ASP.NET Web API and AngularJSBuild Modern Web Apps Using ASP.NET Web API and AngularJS
Build Modern Web Apps Using ASP.NET Web API and AngularJS
Taiseer Joudeh3.8K views
Introduction to Web Frameworks by Sarika Jadhav
Introduction to Web FrameworksIntroduction to Web Frameworks
Introduction to Web Frameworks
Sarika Jadhav81 views
Decoupled Architecture and WordPress by Pantheon
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPress
Pantheon3.6K views
Progressive Web Apps and React by Mike Melusky
Progressive Web Apps and ReactProgressive Web Apps and React
Progressive Web Apps and React
Mike Melusky813 views
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular by Mark Leusink
Escaping the yellow bubble - rewriting Domino using MongoDb and AngularEscaping the yellow bubble - rewriting Domino using MongoDb and Angular
Escaping the yellow bubble - rewriting Domino using MongoDb and Angular
Mark Leusink5K views
Rongde Qiu-DDsmile-2015.1.25 by Rongde Qiu
Rongde Qiu-DDsmile-2015.1.25Rongde Qiu-DDsmile-2015.1.25
Rongde Qiu-DDsmile-2015.1.25
Rongde Qiu209 views
Introduction tosinglepageapplications by Nabeel Khan
Introduction tosinglepageapplicationsIntroduction tosinglepageapplications
Introduction tosinglepageapplications
Nabeel Khan2.9K views
Web Applications Development with MEAN Stack by Shailendra Chauhan
Web Applications Development with MEAN StackWeb Applications Development with MEAN Stack
Web Applications Development with MEAN Stack
Shailendra Chauhan1.1K views
Introduction to ASP.NET by Rajkumarsoy
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
Rajkumarsoy16.8K views
From server generated pages to client app in a micro-services world by Assaf Gannon
From server generated pages to client app in a micro-services worldFrom server generated pages to client app in a micro-services world
From server generated pages to client app in a micro-services world
Assaf Gannon4.7K views

Recently uploaded

UiPath Document Understanding_Day 2.pptx by
UiPath Document Understanding_Day 2.pptxUiPath Document Understanding_Day 2.pptx
UiPath Document Understanding_Day 2.pptxRohitRadhakrishnan8
292 views21 slides
Is Entireweb better than Google by
Is Entireweb better than GoogleIs Entireweb better than Google
Is Entireweb better than Googlesebastianthomasbejan
12 views1 slide
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf by
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfOpportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfRIPE NCC
9 views12 slides
AI Powered event-driven translation bot by
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation botJimmy Dahlqvist
16 views31 slides
Serverless cloud architecture patterns by
Serverless cloud architecture patternsServerless cloud architecture patterns
Serverless cloud architecture patternsJimmy Dahlqvist
17 views52 slides
zotabet.pdf by
zotabet.pdfzotabet.pdf
zotabet.pdfzotabetcasino
6 views1 slide

Recently uploaded(20)

Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf by RIPE NCC
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdfOpportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
Opportunities for Youth in IG - Alena Muravska RIPE NCC.pdf
RIPE NCC9 views
AI Powered event-driven translation bot by Jimmy Dahlqvist
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation bot
Jimmy Dahlqvist16 views
Serverless cloud architecture patterns by Jimmy Dahlqvist
Serverless cloud architecture patternsServerless cloud architecture patterns
Serverless cloud architecture patterns
Jimmy Dahlqvist17 views
Existing documentaries (1).docx by MollyBrown86
Existing documentaries (1).docxExisting documentaries (1).docx
Existing documentaries (1).docx
MollyBrown8613 views
google forms survey (1).pptx by MollyBrown86
google forms survey (1).pptxgoogle forms survey (1).pptx
google forms survey (1).pptx
MollyBrown8614 views
IETF 118: Starlink Protocol Performance by APNIC
IETF 118: Starlink Protocol PerformanceIETF 118: Starlink Protocol Performance
IETF 118: Starlink Protocol Performance
APNIC186 views
UiPath Document Understanding_Day 3.pptx by UiPathCommunity
UiPath Document Understanding_Day 3.pptxUiPath Document Understanding_Day 3.pptx
UiPath Document Understanding_Day 3.pptx
UiPathCommunity101 views
PORTFOLIO 1 (Bret Michael Pepito).pdf by brejess0410
PORTFOLIO 1 (Bret Michael Pepito).pdfPORTFOLIO 1 (Bret Michael Pepito).pdf
PORTFOLIO 1 (Bret Michael Pepito).pdf
brejess04107 views
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf by RIPE NCC
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdfIGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf
IGF UA - Dialog with I_ organisations - Alena Muavska RIPE NCC.pdf
RIPE NCC15 views
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲 by Infosec train
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲
𝐒𝐨𝐥𝐚𝐫𝐖𝐢𝐧𝐝𝐬 𝐂𝐚𝐬𝐞 𝐒𝐭𝐮𝐝𝐲
Infosec train9 views
We see everywhere that many people are talking about technology.docx by ssuserc5935b
We see everywhere that many people are talking about technology.docxWe see everywhere that many people are talking about technology.docx
We see everywhere that many people are talking about technology.docx
ssuserc5935b6 views

Building WordPress sites with AngularJS and the RESTful plugin JSON API @ DevLink 2014

  • 1. Building WordPress sites with AngularJS and the RESTful plugin JSON API DevLink 2014 By: Eric W. Greene http://www.ericwgreene.com @ericwgreene
  • 2. Introduction Web Development is Changing… • Modern web development • Less Server Platform (PHP, Java, .NET) • More Web Browser Platform (HTML/CSS/JavaScript) • Modern web applications • Web server is a repository of user interface templates (HTML, CSS, JS resources) and it provides access to data • Binding of templates and data is handled through JavaScript frameworks on the web browser • Navigating from page to page is handled by Web Browser based JavaScript routing systems that do not involve reloading the entire page from the server • Web browsers use AJAX to send/receive data to/from RESTful services provided by the web server
  • 3. Introduction Why is Web Development Changing? • Web browsers and client devices are becoming more capable • Devices in general (desktops, laptops, tablets, phones) are very powerful • Web browsers are emerging as a true platform • Chromebooks, Chrome Store • Web technology is being used to construct UIs for traditional apps • PhoneGap • Windows 8 Apps • JavaScript on the Server - Node.JS • Used for development and development tooling • More and more libraries being created • Because JavaScript is being used everywhere, developers in general increasingly want to use in the browser
  • 4. Introduction How does this Web Development Change Benefit Users? • Pushing more code to the browser results in application called Single Web Page Applications more commonly called Single Page Applications or simply SPAs • How do users benefit from SPAs? • SPAs in general are more functional (without a page reload) and behave more like desktop apps • In a high network latency environment, a well written SPA can continue to perform acceptably for the user • Example: Marriott and Conference Center Internet • Many SPAs can operate in offline mode allow the user to use the web application even when disconnect then when they connect again everything gets synced up
  • 5. Introduction WordPress (and other Content Management Systems) • When people think WordPress, they think blogging software • But really, WordPress is so much more… Truly, its a very powerful, extensible and capable Content Management System • WordPress has been around for a long time, is well tested, well supported by a huge community of bloggers, developers, plugin & theme providers • WordPress is a great tool but it was also developed in an earlier time when web applications were more server-driven and less browser-driven • Out of the box • WordPress relies upon the server for all processing of the user interface • Real JavaScript functionality is limited
  • 6. Introduction Transforming WordPress • WordPress does not have to be limited to older server-driven techniques • To bring WordPress into the next generation of web apps • Create themes that leverage the power of JavaScript libraries such as KnockoutJS, EmberJS and AngularJS. • Employ plugins which provides RESTful services that provide access to core WordPress data • Up and coming - WP REST API - new RESTful API for WordPress • The result • Blogs and websites which perform better with the latest development technologies
  • 7. Using AngularJS Why AngularJS? • AngularJS is a complete framework for building Single Page Applications • Using the MVC pattern, it can manage your models and views including routing to different views • Supports two-way data binding allow easy data collection via forms • Provide directives to build complex reusable UI components that integrate nicely into your application • Provides an excellent mocking library so you can follow test-driven development principles and really write unit tests for your code before implementation • Allows for the creation of cross cutting services that can provide useful functionality throughout your application • AngularJS is the current hot web development technology - everyone from small shops to very large corporations are embracing it
  • 8. Introduction Goals for Today… • Inform you of the changing landscape of web development with WordPress (or really any other web development platform) • Demonstrate one of the many technologies changing web development today, AngularJS within the context of WordPress • Persuade you to focus less on the server and embrace JavaScript (and its many frameworks) and the Web Browser (as a true platform not just a viewer) for sophisticated and powerful web applications
  • 9. Let’s Get Started… What we will cover • Starting with a clean copy of WordPress • Create a new theme • Add AngularJS to the theme • On the blog home page, replace the usual list of blog entries with an AngularJS powered list • Install the RESTful JSON API Plugin • Use AngularJS to display a specific blog entry • Refactor original blog post listing to use JSON API and angular.ForEach • Clean up routing URLs using HTML 5 Mode • Move Module to External JS File
  • 10. Thank You for Attending! Some Good AngularJS Resources • Some good resources for learning more about AngularJS • Pro AngularJS from APress (http://www.apress.com/9781430264484) • Ng-Book (https://www.ng-book.com/) • WintellectNow Training Videos (https://www.wintellectnow.com/Videos/Index?searchString=Angul arJS) • Accelebrate, Inc. On-site Training (http://www.accelebrate.com/) • WordPress REST API (instead of the JSON API Plugin) • http://wp-api.org/ • Download Today’s Demos • https://github.com/ericwgreene/wordpress-angularjs-jsonapi • Includes all source code and PDF of slide deck