SlideShare a Scribd company logo
WordPress: an application platform? 
Tim Stephenson 
@tstephen10 
Attribution 
CC BY
Why WordPress? 
● Working with lots of startups and SMEs as I do 
I frequently encounter a need for a user-manageable 
content management platform. 
● Combining an initial development phase with 
WordPress 'core' and some carefully chosen 
plugins meets this with an acceptable balance 
of quality and price.
Why WordPress? 
Source: WordCamp SF 2014 'State of the Word' keynote
Not your Dad's WordPress! 
Source: WordCamp SF 2014 'State of the Word' keynote
WordPress 4.1 
A big focus on supporting non-English speakers, including... 
Source: WordCamp SF 2014 'State of the Word' keynote
WordPress 4.? 
The REST (!) of this presentation will focus on a short exploration of this new API
The Brief 
 A simple app to record billable work including 
time, project code, description of work etc. 
 Must be mobile browser ready. 
 And the client hates WordPress so I better not 
see any of tell-tale signs of that horrible UI.
Steps 
1. Write some simple semantic HTML 
- Record time 
- Review invoice 
2. Replace static HTML with templates and 
model bindings 
3. Replace static JSON files with WP service
Step 1: Some Semantic HTML 
<form role="form"> 
<div class="form-group"> 
<label for="project">Who for?</label> 
<select class="form-control" id="project"> 
... 
</select> 
</div> 
<div class="form-group"> 
<label for="taskName">What?</label> 
<input class="form-control" id="taskName" 
placeholder="Name of task"> 
</div> 
... 
<button type="submit">Submit</button> 
</form>
Quick Poll: Angular JS 
● Love it! 
● Hate it! 
● “Does the job” 
● Angle what?
Step 2: Templates and Binding 
● Don't get me wrong, Angular has lots of merits 
not least providing structure to larger projects... 
● BUT... 
– It can at be excessively constraining (IMHO) 
– I thought I'd take the opportunity to look at 
Ractive.js, created by The Guardian team
Ractive.js 
<!-- 
1. This is the element we'll render our Ractive to. 
--> 
<nav class="navbar navbar-inverse navbar-fixed-top" 
role="navigation"> 
</nav>
Ractive.js 
<!-- 
2. Load a template can be done in many ways, here an embedded script element. 
--> 
<script id="navbar-template" type="text/ractive"> 
<div class="container"> 
... 
<div id="navbar" class="collapse navbar-collapse"> 
<ul class="nav navbar-nav"> 
<li><a href="#time" on-click="activateTime">Time</a></li> 
<li><a href="#invoice" on-click="activateInvoice">Invoice</a></li> 
<li class="active"><a href="#about" on-click="activateAbout">About</a></li> 
</ul> 
</div><!--/.nav-collapse --> 
</div> 
</script>
Ractive.js 
<!-- 
3. Initialize our Ractive controller. 
--> 
var navbarCtrl = new Ractive({ 
// The `el` option can be a node, an ID, or a CSS selector. 
el: 'nav', 
// We could pass in a string, but for the sake of convenience 
// we're passing the ID of the <script> tag above. 
template: '#navbar-template' 
// No need to pass in initial data 
//data: { name: 'XYZ' } 
});
Ractive.js 
<!-- 
4. Add on-click handler... 
--> 
navbarCtrl.on('activateTime', function ( event ) { 
// activateTime is the name we declared in the template's on-click attribute 2 slides back 
... 
}); 
<!-- 
...and annotate with model bindings 
--> 
<input type="date" class="form-control" id="invoice-end" placeholder="dd/mm/yyyy" 
value="{{invoice.endDate}}">
Step 3: Create a [Time] Post 
● The API is quite comprehensive but as with 
WordPress generally, lots of things end up 
being a 'Post' 
● My Time Entry is such an example 
● Visit http://wp-api.org/ for the full list of APIs
Step 3: Create a [Time] Post 
● Create a Time Entry: POST /posts 
– PUT (for update) and DELETE exist too 
● Attach duration and other attributes: POST /posts/id/meta 
$.ajax({ 
type: 'POST', 
url: SRVR+"/wp-json/posts", 
data: JSON.stringify(time) 
}) 
.done(function( data, textStatus, jqXHR ) { 
var msg = 'Successfully created post: <a href="'+data.link+'" target="_newtab">View</a>'; 
$( ".result" ).html( msg ); 
$.ajax({ 
type: 'POST', 
url: SRVR+"/wp-json/posts/"+data.ID+"/meta", 
data: JSON.stringify({key:'duration',value:time.duration}) 
}) 
.done(function( data2 ) { 
... 
}); 
});
Conclusions 
● It is possible to completely mask the WordPress dashboard 
from users and to create modern applications that still have 
access to all the features of a WordPress 'back-end' 
● Clearly that only makes sense when you have a good reason 
to use WordPress already 
● As an app platform making separate calls to manage Posts 
and their associated meta-data could be wasteful if the main 
content is small 
● Admin functionality is not included at present (deploy plugin, 
activate theme etc.)
References 
● WordCamp SF 2014 'State of the Word': 
http://blog.wordpress.tv/2014/10/29/wordcamp-san-francisco-2014-state-of-the-word-keynote/ 
http://www.slideshare.net/photomatt/state-of-the-word-2014 
● WP-API http://wp-api.org/ 
● Ractive.js http://learn.ractivejs.org/partials/1 
● Source: http://github.com/tstephen/wp-invoices

More Related Content

PDF
Building Isomorphic JavaScript Apps - NDC 2015
PPTX
Single Page WebApp Architecture
PDF
JSConf US 2014: Building Isomorphic Apps
PDF
JavaScript Web Workers
PDF
WordPress and Client Side Web Applications WCTO
PDF
SxSW 2015
PDF
Node, express & sails
KEY
Getting Started with HTML 5 Web workers
Building Isomorphic JavaScript Apps - NDC 2015
Single Page WebApp Architecture
JSConf US 2014: Building Isomorphic Apps
JavaScript Web Workers
WordPress and Client Side Web Applications WCTO
SxSW 2015
Node, express & sails
Getting Started with HTML 5 Web workers

What's hot (20)

PDF
Web workers
PPTX
webworkers
PDF
Back to the future: Isomorphic javascript applications
PPTX
HTML5 Web Workers-unleashed
PPT
You Know WebOS
PDF
Wordcamp Toronto Presentation
PDF
Instant and offline apps with Service Worker
ZIP
The 5 Layers of Web Accessibility
PDF
Chrome enchanted 2015
PPTX
Don't Over-React - just use Vue!
PDF
Visual resume
PPT
Java script202
PDF
Tutorial: Develop Mobile Applications with AngularJS
PPTX
HTML5 for Rich User Experience
PPT
Django for n00bs
PDF
Client Side Applications with WP-API WordPress - WCMTL 2015
PDF
Ember Reusable Components and Widgets
PDF
Introduction to VueJS & The WordPress REST API
PPTX
Goodbye JavaScript Hello Blazor
PPT
Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...
Web workers
webworkers
Back to the future: Isomorphic javascript applications
HTML5 Web Workers-unleashed
You Know WebOS
Wordcamp Toronto Presentation
Instant and offline apps with Service Worker
The 5 Layers of Web Accessibility
Chrome enchanted 2015
Don't Over-React - just use Vue!
Visual resume
Java script202
Tutorial: Develop Mobile Applications with AngularJS
HTML5 for Rich User Experience
Django for n00bs
Client Side Applications with WP-API WordPress - WCMTL 2015
Ember Reusable Components and Widgets
Introduction to VueJS & The WordPress REST API
Goodbye JavaScript Hello Blazor
Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...
Ad

Viewers also liked (17)

PPT
Review of street cleansing and ground maintenance services
PPT
Implementation of the new waste & recycling service
PPTX
Making difficult decisions to ensure the future of quality health care for you
PPT
Your say on our 2015 budget
PPT
Community Area Forums Budget Presentation
PPT
The changing face of local government and its impact on the Derbyshire Dales
PPTX
Derbyshire Dales District Council FY2015/16 spending plans and priorities
PPT
Derbyshire Dales Budget consultation February 2014
PPTX
Erewash credit union's expansion into Derbyshire Dales
PPTX
Presentation1
PPTX
Individual Electoral Registration presentation - July 2014
PPT
Ashbourne Partnership Presentation - July 2014
PPTX
NHS Clinical Commissioning Group presentation Feb 2014
PPTX
Standing as a candidate at the 2015 Elections
PPT
Review of car parking policy
PPT
Supporting Business in the Derbyshire Dales
PDF
Cuidamos la imagen de su negocio
Review of street cleansing and ground maintenance services
Implementation of the new waste & recycling service
Making difficult decisions to ensure the future of quality health care for you
Your say on our 2015 budget
Community Area Forums Budget Presentation
The changing face of local government and its impact on the Derbyshire Dales
Derbyshire Dales District Council FY2015/16 spending plans and priorities
Derbyshire Dales Budget consultation February 2014
Erewash credit union's expansion into Derbyshire Dales
Presentation1
Individual Electoral Registration presentation - July 2014
Ashbourne Partnership Presentation - July 2014
NHS Clinical Commissioning Group presentation Feb 2014
Standing as a candidate at the 2015 Elections
Review of car parking policy
Supporting Business in the Derbyshire Dales
Cuidamos la imagen de su negocio
Ad

Similar to WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08 (20)

PPTX
Webinar: AngularJS and the WordPress REST API
PPTX
Webinar: AngularJS and the WordPress REST API
PDF
Course CodeSchool - Shaping up with Angular.js
PDF
243329387 angular-docs
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPT
Html javascript
PPTX
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
PPTX
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
PPTX
Angular js
PDF
End-to-end web-testing in ruby ecosystem
PDF
Developing High Performance Web Apps
PPTX
JavaScripts & jQuery
PDF
Using the new WordPress REST API
PDF
Tek 2013 - Building Web Apps from a New Angle with AngularJS
KEY
Intro To Django
PDF
Isomorphic JavaScript: #DevBeat Master Class
PDF
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
PDF
[Bristol WordPress] Supercharging WordPress Development
PDF
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
PPTX
WordCamp Montreal 2016 WP-API + React with server rendering
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
Course CodeSchool - Shaping up with Angular.js
243329387 angular-docs
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
Html javascript
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
Angular js
End-to-end web-testing in ruby ecosystem
Developing High Performance Web Apps
JavaScripts & jQuery
Using the new WordPress REST API
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Intro To Django
Isomorphic JavaScript: #DevBeat Master Class
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
[Bristol WordPress] Supercharging WordPress Development
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
WordCamp Montreal 2016 WP-API + React with server rendering

Recently uploaded (20)

PPT
250152213-Excitation-SystemWERRT (1).ppt
PDF
The New Creative Director: How AI Tools for Social Media Content Creation Are...
PPTX
Mathew Digital SEO Checklist Guidlines 2025
DOC
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
PPTX
Module 1 - Cyber Law and Ethics 101.pptx
PPT
Ethics in Information System - Management Information System
PDF
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
PPTX
newyork.pptxirantrafgshenepalchinachinane
PDF
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
PPTX
artificial intelligence overview of it and more
PPTX
INTERNET------BASICS-------UPDATED PPT PRESENTATION
PDF
Sims 4 Historia para lo sims 4 para jugar
PDF
Unit-1 introduction to cyber security discuss about how to secure a system
PDF
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PDF
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
PPTX
t_and_OpenAI_Combined_two_pressentations
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PPTX
Digital Literacy And Online Safety on internet
250152213-Excitation-SystemWERRT (1).ppt
The New Creative Director: How AI Tools for Social Media Content Creation Are...
Mathew Digital SEO Checklist Guidlines 2025
Rose毕业证学历认证,利物浦约翰摩尔斯大学毕业证国外本科毕业证
Module 1 - Cyber Law and Ethics 101.pptx
Ethics in Information System - Management Information System
FINAL CALL-6th International Conference on Networks & IOT (NeTIOT 2025)
newyork.pptxirantrafgshenepalchinachinane
💰 𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓 💰
artificial intelligence overview of it and more
INTERNET------BASICS-------UPDATED PPT PRESENTATION
Sims 4 Historia para lo sims 4 para jugar
Unit-1 introduction to cyber security discuss about how to secure a system
Smart Home Technology for Health Monitoring (www.kiu.ac.ug)
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
Design_with_Watersergyerge45hrbgre4top (1).ppt
mera desh ae watn.(a source of motivation and patriotism to the youth of the ...
t_and_OpenAI_Combined_two_pressentations
Power Point - Lesson 3_2.pptx grad school presentation
Digital Literacy And Online Safety on internet

WordPress as a Platform - talk to Bristol Open Source Meetup, 2014-12-08

  • 1. WordPress: an application platform? Tim Stephenson @tstephen10 Attribution CC BY
  • 2. Why WordPress? ● Working with lots of startups and SMEs as I do I frequently encounter a need for a user-manageable content management platform. ● Combining an initial development phase with WordPress 'core' and some carefully chosen plugins meets this with an acceptable balance of quality and price.
  • 3. Why WordPress? Source: WordCamp SF 2014 'State of the Word' keynote
  • 4. Not your Dad's WordPress! Source: WordCamp SF 2014 'State of the Word' keynote
  • 5. WordPress 4.1 A big focus on supporting non-English speakers, including... Source: WordCamp SF 2014 'State of the Word' keynote
  • 6. WordPress 4.? The REST (!) of this presentation will focus on a short exploration of this new API
  • 7. The Brief  A simple app to record billable work including time, project code, description of work etc.  Must be mobile browser ready.  And the client hates WordPress so I better not see any of tell-tale signs of that horrible UI.
  • 8. Steps 1. Write some simple semantic HTML - Record time - Review invoice 2. Replace static HTML with templates and model bindings 3. Replace static JSON files with WP service
  • 9. Step 1: Some Semantic HTML <form role="form"> <div class="form-group"> <label for="project">Who for?</label> <select class="form-control" id="project"> ... </select> </div> <div class="form-group"> <label for="taskName">What?</label> <input class="form-control" id="taskName" placeholder="Name of task"> </div> ... <button type="submit">Submit</button> </form>
  • 10. Quick Poll: Angular JS ● Love it! ● Hate it! ● “Does the job” ● Angle what?
  • 11. Step 2: Templates and Binding ● Don't get me wrong, Angular has lots of merits not least providing structure to larger projects... ● BUT... – It can at be excessively constraining (IMHO) – I thought I'd take the opportunity to look at Ractive.js, created by The Guardian team
  • 12. Ractive.js <!-- 1. This is the element we'll render our Ractive to. --> <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation"> </nav>
  • 13. Ractive.js <!-- 2. Load a template can be done in many ways, here an embedded script element. --> <script id="navbar-template" type="text/ractive"> <div class="container"> ... <div id="navbar" class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="#time" on-click="activateTime">Time</a></li> <li><a href="#invoice" on-click="activateInvoice">Invoice</a></li> <li class="active"><a href="#about" on-click="activateAbout">About</a></li> </ul> </div><!--/.nav-collapse --> </div> </script>
  • 14. Ractive.js <!-- 3. Initialize our Ractive controller. --> var navbarCtrl = new Ractive({ // The `el` option can be a node, an ID, or a CSS selector. el: 'nav', // We could pass in a string, but for the sake of convenience // we're passing the ID of the <script> tag above. template: '#navbar-template' // No need to pass in initial data //data: { name: 'XYZ' } });
  • 15. Ractive.js <!-- 4. Add on-click handler... --> navbarCtrl.on('activateTime', function ( event ) { // activateTime is the name we declared in the template's on-click attribute 2 slides back ... }); <!-- ...and annotate with model bindings --> <input type="date" class="form-control" id="invoice-end" placeholder="dd/mm/yyyy" value="{{invoice.endDate}}">
  • 16. Step 3: Create a [Time] Post ● The API is quite comprehensive but as with WordPress generally, lots of things end up being a 'Post' ● My Time Entry is such an example ● Visit http://wp-api.org/ for the full list of APIs
  • 17. Step 3: Create a [Time] Post ● Create a Time Entry: POST /posts – PUT (for update) and DELETE exist too ● Attach duration and other attributes: POST /posts/id/meta $.ajax({ type: 'POST', url: SRVR+"/wp-json/posts", data: JSON.stringify(time) }) .done(function( data, textStatus, jqXHR ) { var msg = 'Successfully created post: <a href="'+data.link+'" target="_newtab">View</a>'; $( ".result" ).html( msg ); $.ajax({ type: 'POST', url: SRVR+"/wp-json/posts/"+data.ID+"/meta", data: JSON.stringify({key:'duration',value:time.duration}) }) .done(function( data2 ) { ... }); });
  • 18. Conclusions ● It is possible to completely mask the WordPress dashboard from users and to create modern applications that still have access to all the features of a WordPress 'back-end' ● Clearly that only makes sense when you have a good reason to use WordPress already ● As an app platform making separate calls to manage Posts and their associated meta-data could be wasteful if the main content is small ● Admin functionality is not included at present (deploy plugin, activate theme etc.)
  • 19. References ● WordCamp SF 2014 'State of the Word': http://blog.wordpress.tv/2014/10/29/wordcamp-san-francisco-2014-state-of-the-word-keynote/ http://www.slideshare.net/photomatt/state-of-the-word-2014 ● WP-API http://wp-api.org/ ● Ractive.js http://learn.ractivejs.org/partials/1 ● Source: http://github.com/tstephen/wp-invoices