SlideShare uma empresa Scribd logo
1 de 19
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

Mais conteúdo relacionado

Mais procurados

HTML5 Web Workers-unleashed
HTML5 Web Workers-unleashedHTML5 Web Workers-unleashed
HTML5 Web Workers-unleashed
Peter Lubbers
 
Java script202
Java script202Java script202
Java script202
Wasiq Zia
 
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
 
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
 

Mais procurados (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...
 

Destaque

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
 
Cuidamos la imagen de su negocio
Cuidamos la imagen de su negocioCuidamos la imagen de su negocio
Cuidamos la imagen de su negocio
PromoPublic
 

Destaque (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
 

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

Isomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master ClassIsomorphic JavaScript: #DevBeat Master Class
Isomorphic JavaScript: #DevBeat Master Class
Spike Brehm
 

Semelhante a 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
 

Último

valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Chandigarh Call girls 9053900678 Call girls in Chandigarh
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
nilamkumrai
 

Último (20)

Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft DatingDubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
Dubai Call Girls Milky O525547819 Call Girls Dubai Soft Dating
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providersMoving Beyond Twitter/X and Facebook - Social Media for local news providers
Moving Beyond Twitter/X and Facebook - Social Media for local news providers
 
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort ServiceBusty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
Busty Desi⚡Call Girls in Vasundhara Ghaziabad >༒8448380779 Escort Service
 
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
valsad Escorts Service ☎️ 6378878445 ( Sakshi Sinha ) High Profile Call Girls...
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Pollachi 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Himatnagar 7001035870 Whatsapp Number, 24/07 Booking
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
Low Sexy Call Girls In Mohali 9053900678 🥵Have Save And Good Place 🥵
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
( Pune ) VIP Baner Call Girls 🎗️ 9352988975 Sizzling | Escorts | Girls Are Re...
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
VVIP Pune Call Girls Mohammadwadi WhatSapp Number 8005736733 With Elite Staff...
 

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