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

What's hot

Web workers
Web workersWeb workers
Web workers
Surbhi Mathur
 
webworkers
webworkerswebworkers
webworkers
Asanka Indrajith
 
Back to the future: Isomorphic javascript applications
Back to the future:  Isomorphic javascript applicationsBack to the future:  Isomorphic javascript applications
Back to the future: Isomorphic javascript applications
Luciano Colosio
 
HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
Peter Lubbers
 
You Know WebOS
You Know WebOSYou Know WebOS
You Know WebOS
360|Conferences
 
Wordcamp Toronto Presentation
Wordcamp Toronto PresentationWordcamp Toronto Presentation
Wordcamp Toronto Presentation
Roy Sivan
 
Instant and offline apps with Service Worker
Instant and offline apps with Service WorkerInstant and offline apps with Service Worker
Instant and offline apps with Service Worker
Chang W. Doh
 
The 5 Layers of Web Accessibility
The 5 Layers of Web AccessibilityThe 5 Layers of Web Accessibility
The 5 Layers of Web Accessibility
Dirk Ginader
 
Chrome enchanted 2015
Chrome enchanted 2015Chrome enchanted 2015
Chrome enchanted 2015
Chang W. Doh
 
Don't Over-React - just use Vue!
Don't Over-React - just use Vue!Don't Over-React - just use Vue!
Don't Over-React - just use Vue!
Raymond Camden
 
Visual resume
Visual resumeVisual resume
Visual resume
Milan Skorić
 
Java script202
Java script202Java script202
Java script202
Wasiq Zia
 
Tutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJSTutorial: Develop Mobile Applications with AngularJS
Tutorial: Develop Mobile Applications with AngularJS
Philipp Burgmer
 
HTML5 for Rich User Experience
HTML5 for Rich User ExperienceHTML5 for Rich User Experience
HTML5 for Rich User Experience
Mahbubur Rahman
 
Django for n00bs
Django for n00bsDjango for n00bs
Django for n00bs
Jen Zajac
 
Client Side Applications with WP-API WordPress - WCMTL 2015
Client Side Applications with WP-API WordPress - WCMTL 2015Client Side Applications with WP-API WordPress - WCMTL 2015
Client Side Applications with WP-API WordPress - WCMTL 2015
Roy Sivan
 
Ember Reusable Components and Widgets
Ember Reusable Components and WidgetsEmber Reusable Components and Widgets
Ember Reusable Components and Widgets
Sergey Bolshchikov
 
Introduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST APIIntroduction to VueJS & The WordPress REST API
Introduction to VueJS & The WordPress REST API
Caldera Labs
 
Goodbye JavaScript Hello Blazor
Goodbye JavaScript Hello BlazorGoodbye JavaScript Hello Blazor
Goodbye JavaScript Hello Blazor
Ed Charbeneau
 
Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...
Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...
Taking Advantage of Client Side / JavsScript Templates in Rich Internet Appli...
Mahbubur Rahman
 

What's hot (20)

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

Viewers also liked

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

Viewers also liked (17)

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

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

Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
WP Engine
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
WP Engine UK
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.js
Vinícius de Moraes
 
243329387 angular-docs
243329387 angular-docs243329387 angular-docs
243329387 angular-docs
Abhi166803
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
All Things Open
 
Html javascript
Html javascriptHtml javascript
Html javascript
Soham Sengupta
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
POSSCON
 
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
murtazahaveliwala
 
Angular js
Angular jsAngular js
Angular js
Mauro Servienti
 
End-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystemEnd-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystem
Alex Mikitenko
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
Timothy Fisher
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
Asanka Indrajith
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
Caldera Labs
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Pablo Godel
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
Udi Bauman
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
WordCamp San Diego 2015 - WordPress, WP-API, and Web ApplicationsWordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
Roy Sivan
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
Adam Tomat
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
Paul Jensen
 
WordCamp Montreal 2016 WP-API + React with server rendering
WordCamp Montreal 2016  WP-API + React with server renderingWordCamp Montreal 2016  WP-API + React with server rendering
WordCamp Montreal 2016 WP-API + React with server rendering
Ziad Saab
 

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

Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Webinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST APIWebinar: AngularJS and the WordPress REST API
Webinar: AngularJS and the WordPress REST API
 
Course CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.jsCourse CodeSchool - Shaping up with Angular.js
Course CodeSchool - Shaping up with Angular.js
 
243329387 angular-docs
243329387 angular-docs243329387 angular-docs
243329387 angular-docs
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
 
Html javascript
Html javascriptHtml javascript
Html javascript
 
I Know It Was MEAN, But I Cut the Cord to LAMP Anyway
I Know It Was MEAN, But I Cut the Cord to LAMP AnywayI Know It Was MEAN, But I Cut the Cord to LAMP Anyway
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
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJSAngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
AngularJS training - Day 1 - Basics: Why, What and basic features of AngularJS
 
Angular js
Angular jsAngular js
Angular js
 
End-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystemEnd-to-end web-testing in ruby ecosystem
End-to-end web-testing in ruby ecosystem
 
Developing High Performance Web Apps
Developing High Performance Web AppsDeveloping High Performance Web Apps
Developing High Performance Web Apps
 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
 
Using the new WordPress REST API
Using the new WordPress REST APIUsing the new WordPress REST API
Using the new WordPress REST API
 
Tek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJSTek 2013 - Building Web Apps from a New Angle with AngularJS
Tek 2013 - Building Web Apps from a New Angle with AngularJS
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
 
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
WordCamp San Diego 2015 - WordPress, WP-API, and Web ApplicationsWordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
WordCamp San Diego 2015 - WordPress, WP-API, and Web Applications
 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
 
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
End to end testing Single Page Apps & APIs with Cucumber.js and Puppeteer (Em...
 
WordCamp Montreal 2016 WP-API + React with server rendering
WordCamp Montreal 2016  WP-API + React with server renderingWordCamp Montreal 2016  WP-API + React with server rendering
WordCamp Montreal 2016 WP-API + React with server rendering
 

Recently uploaded

留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
3a0sd7z3
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
3a0sd7z3
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
davidjhones387
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
rtunex8r
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
uehowe
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
k4ncd0z
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
Tarandeep Singh
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
Donato Onofri
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 

Recently uploaded (16)

留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
快速办理(Vic毕业证书)惠灵顿维多利亚大学毕业证完成信一模一样
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
快速办理(新加坡SMU毕业证书)新加坡管理大学毕业证文凭证书一模一样
 
Discover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to IndiaDiscover the benefits of outsourcing SEO to India
Discover the benefits of outsourcing SEO to India
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
怎么办理(umiami毕业证书)美国迈阿密大学毕业证文凭证书实拍图原版一模一样
 
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
办理毕业证(NYU毕业证)纽约大学毕业证成绩单官方原版办理
 
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理一比一原版(USYD毕业证)悉尼大学毕业证如何办理
一比一原版(USYD毕业证)悉尼大学毕业证如何办理
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
Bengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal BrandingBengaluru Dreamin' 24 - Personal Branding
Bengaluru Dreamin' 24 - Personal Branding
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
HijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process HollowingHijackLoader Evolution: Interactive Process Hollowing
HijackLoader Evolution: Interactive Process Hollowing
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 

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