SlideShare a Scribd company logo
Using WordPress as 
your application stack 
WHY AND HOW
@me 
Senior Full Stack WordPress Developer 
Plugin author of Author Avatars List http://wordpress.org/plugins/author-avatars/ 
and WP Site Verification tool http://wordpress.org/plugins/wp-site-verification-tool/ 
Slides @ http://www.slideshare.net/pbearne
Why WordPress? 
•Stable 
•Supported 
•Community 
•Scales
Why not WordPress? 
•Code debt 
•PHP 
•Has PHP global’s 
•Not sexy
23% 
OF THE SITES IN WHOLE INTERNET
34,000 
PLUG-INS
2,800 
THEMES
How 
•Actions and filters 
•JSON API 
•jQuery - Backbone 
•Template hierarchy 
•Custom post types
Filter 
add_filter(‘fliter_name’, ‘function_to_run’); 
Function function_to_run( $var ){ 
$var .= ‘hello world’; 
return $var; 
} 
http://codex.wordpress.org/Plugin_API#Filters
Action 
add_action(‘action_name’, ‘function_to_run’); 
Function function_to_run( $var = null ){ 
echo ‘hello world’; 
} 
http://codex.wordpress.org/Plugin_API#Actions
Ajax Route 
/** 
* Register a rewrite endpoint for the API. 
*/ 
function prefix_add_api_endpoints() { 
add_rewrite_tag( '%api_item_id%', '([0-9]+)' ); 
add_rewrite_rule( 'api/items/([0-9]+)/?', 
'index.php?api_item_id=$matches[1]', 'top' ); 
} 
add_action( 'init', 'prefix_add_api_endpoints' ); 
https://10up.github.io/Engineering-Best-Practices/php/#ajax-endpoints
Ajax handler 
function prefix_do_api() { 
global $wp_query; 
$item_id = $wp_query->get( 'api_item_id' ); 
if ( ! empty( $item_id ) ) { 
$response = array(); 
// Do stuff with $item_id 
wp_send_json( $response ); 
} 
} 
add_action( 'template_redirect', 'prefix_do_api' );
JSON API wordpress.com 
Part of the Jetpack plug-in 
http://developer.wordpress.com/docs/api/ 
https://developer.wordpress.com/docs/api/console/ 
End point 
https://public-api.wordpress.com/rest/v1/ 
e.g. 
https://public-api. 
wordpress.com/rest/v1/sites/authoravatars.wordpress.com/
JSON API wp.org (self host) 
Part of next version of core (currently plug-in) 
http://wp-api.org/ 
End point 
https://domain.com/wp-json/
JSON API wp-api.org/ v. WP.com 
WP.com 
Wp-api.org 
Caching 
On you server 
Little load on your servers 
Extendable 
Access to WordPress.com user and stats 
More complete 
The API’s don’t match (yet)
BackBone 
Included with WordPress  
To just load it 
wp_enqueue_script( ‘backbone’ ); 
Or better still load as a dependency of your script 
wp_enqueue_script( ‘myscript’, ‘path/to/script, array( 'backbone' ) ); 
https://github.com/tlovett1/_s_backbone
Template Hierarchy 
The order Wordpress load its template files 
http://codex.wordpress.org/Template_Hierarchy
Template Hierarchy
Custom post types 
The main logical data object 
in WordPress 
The standard types are : 
post, page, media 
add_action( 'init', 'create_post_type' ); 
function create_post_type() { 
register_post_type( 
'acme_product', 
array( 'labels' => array( 
'name' => __( 'Products' ), 
'singular_name' => __( 'Product' ) 
), 
'public' => true, 
'has_archive' => true, ) 
); 
} 
http://codex.wordpress.org/Post_Types
Custom metadata 
The data linked to a post object 
Text or serialized data 
Use CMB2 to easily create admin forms 
Hide the metadata from admin by 
starting the id with an “_” 
$meta_boxes[ 'tombstone_page_metabox' ] = array( 
'id' => __( 'tombstone_page_metabox', 
Config::get_text_domain() ), 
'title' => __( 'Tombstone Details', 
Config::get_text_domain() ), 
'object_types' => array( self::get_tombstone_post_type() ), 
https://github.com/WebDevStudios/CMB2 
// Post types 
'context' => 'normal', 
'priority' => 'high', 
'show_names' => true, // Show field names on the left 
'fields' => array( 
array( 
'name' => __( 'Tag line', Config::get_text_domain() 
), 
'desc' => __( 'Enter the pull Quote', 
Config::get_text_domain() ), 
'id' => Config::_get_prefix() . 'tagline', 
'type' => 'textarea_small', 
'attributes' => array( 
'style' => 'width:100%;', 
), 
), 
) 
);
Call external API and cache 
Use the internal 
wp_remote_get() get remote data. 
Then cache the data with a 
transients cache 
or 
tlc_transient() 
$request = wp_remote_get('http://example.com'); 
$response = wp_remote_retrieve_body( $request ); 
echo $response; 
<?php 
// Define your callback (other examples use 
this) 
function my_callback() { 
return wp_remote_retrieve_body( 
wp_remote_get( 'http://example.com/feed.xml', 
array( 'timeout' => 30 ) ) 
); 
} // Grab that feed echo 
$data = tlc_transient( 'example-feed' ) 
->updates_with( 'my_callback' ) 
->expires_in( 300 ) 
->get(); 
If( false != $data ){ 
// show data 
} 
?> 
https://github.com/markjaquith/WP-TLC-Transients
Questions? 
http://www.slideshare.net/pbearne
Ad

More Related Content

What's hot (20)

An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
Jeremy Kendall
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
Samantha Geitz
 
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Arc & Codementor
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
Jeremy Kendall
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 
RESTful web services
RESTful web servicesRESTful web services
RESTful web services
Tudor Constantin
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
Elena Kolevska
 
Developing apps using Perl
Developing apps using PerlDeveloping apps using Perl
Developing apps using Perl
Anatoly Sharifulin
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
Paul Bearne
 
Silex, the microframework
Silex, the microframeworkSilex, the microframework
Silex, the microframework
Inviqa
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
Yusuke Wada
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
Kris Wallsmith
 
Mojolicious
MojoliciousMojolicious
Mojolicious
Marcos Rebelo
 
WordPress REST API hacking
WordPress REST API hackingWordPress REST API hacking
WordPress REST API hacking
Jeroen van Dijk
 
Rails 4.0
Rails 4.0Rails 4.0
Rails 4.0
Robert Gogolok
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
Jeroen van Dijk
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
Yehuda Katz
 
An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
 
Keeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro frameworkKeeping it small: Getting to know the Slim micro framework
Keeping it small: Getting to know the Slim micro framework
Jeremy Kendall
 
REST APIs in Laravel 101
REST APIs in Laravel 101REST APIs in Laravel 101
REST APIs in Laravel 101
Samantha Geitz
 
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
The Coolest Symfony Components you’ve never heard of - DrupalCon 2017
Ryan Weaver
 
Phpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friendsPhpne august-2012-symfony-components-friends
Phpne august-2012-symfony-components-friends
Michael Peacock
 
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Building Modern and Secure PHP Applications – Codementor Office Hours with Be...
Arc & Codementor
 
Keeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro frameworkKeeping it small - Getting to know the Slim PHP micro framework
Keeping it small - Getting to know the Slim PHP micro framework
Jeremy Kendall
 
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram VaswaniCreating REST Applications with the Slim Micro-Framework by Vikram Vaswani
Creating REST Applications with the Slim Micro-Framework by Vikram Vaswani
vvaswani
 
Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5Bootstrat REST APIs with Laravel 5
Bootstrat REST APIs with Laravel 5
Elena Kolevska
 
Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919Childthemes ottawa-word camp-1919
Childthemes ottawa-word camp-1919
Paul Bearne
 
Silex, the microframework
Silex, the microframeworkSilex, the microframework
Silex, the microframework
Inviqa
 
Inside Bokete: Web Application with Mojolicious and others
Inside Bokete:  Web Application with Mojolicious and othersInside Bokete:  Web Application with Mojolicious and others
Inside Bokete: Web Application with Mojolicious and others
Yusuke Wada
 
WordPress REST API hacking
WordPress REST API hackingWordPress REST API hacking
WordPress REST API hacking
Jeroen van Dijk
 
The Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/PressThe Enterprise Wor/d/thy/Press
The Enterprise Wor/d/thy/Press
Jeroen van Dijk
 
Rails 3 overview
Rails 3 overviewRails 3 overview
Rails 3 overview
Yehuda Katz
 

Viewers also liked (7)

Daughter Themes
Daughter ThemesDaughter Themes
Daughter Themes
Paul Bearne
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
Paul Bearne
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes
Paul Bearne
 
Gravity Forms Hooks & Filters
Gravity Forms Hooks & FiltersGravity Forms Hooks & Filters
Gravity Forms Hooks & Filters
iamdangavin
 
Tips and tricks for using wordpress as application platform.
Tips and tricks for using wordpress as application platform.Tips and tricks for using wordpress as application platform.
Tips and tricks for using wordpress as application platform.
danwestall
 
Professional Frontend Engineering
Professional Frontend EngineeringProfessional Frontend Engineering
Professional Frontend Engineering
Cheton Wu
 
High Performance Web Sites - Tips for faster pages
High Performance Web Sites - Tips for faster pagesHigh Performance Web Sites - Tips for faster pages
High Performance Web Sites - Tips for faster pages
Cheton Wu
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
Paul Bearne
 
WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes WordPress overloading Gravityforms using hooks, filters and extending classes
WordPress overloading Gravityforms using hooks, filters and extending classes
Paul Bearne
 
Gravity Forms Hooks & Filters
Gravity Forms Hooks & FiltersGravity Forms Hooks & Filters
Gravity Forms Hooks & Filters
iamdangavin
 
Tips and tricks for using wordpress as application platform.
Tips and tricks for using wordpress as application platform.Tips and tricks for using wordpress as application platform.
Tips and tricks for using wordpress as application platform.
danwestall
 
Professional Frontend Engineering
Professional Frontend EngineeringProfessional Frontend Engineering
Professional Frontend Engineering
Cheton Wu
 
High Performance Web Sites - Tips for faster pages
High Performance Web Sites - Tips for faster pagesHigh Performance Web Sites - Tips for faster pages
High Performance Web Sites - Tips for faster pages
Cheton Wu
 
Ad

Similar to Using WordPress as your application stack (20)

Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworks
wcto2017
 
Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworks
Kiera Howe
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
Beau Lebens
 
Blog Hacks 2011
Blog Hacks 2011Blog Hacks 2011
Blog Hacks 2011
Yusuke Wada
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 
WordPress and Ajax
WordPress and AjaxWordPress and Ajax
WordPress and Ajax
Ronald Huereca
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
Tammy Hart
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Hisateru Tanaka
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
Alona Mekhovova
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
Mostafa Soufi
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
 
Silex Cheat Sheet
Silex Cheat SheetSilex Cheat Sheet
Silex Cheat Sheet
Andréia Bohner
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011
Maurizio Pelizzone
 
Digging into WordPress custom fields - WordCamp Brno 2017
Digging into WordPress custom fields - WordCamp Brno 2017Digging into WordPress custom fields - WordCamp Brno 2017
Digging into WordPress custom fields - WordCamp Brno 2017
Magdalena Paciorek
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
Lester Chan
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress Plugin
Will Norris
 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
Brian Hogg
 
Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworks
wcto2017
 
Custom post-framworks
Custom post-framworksCustom post-framworks
Custom post-framworks
Kiera Howe
 
WordPress as the Backbone(.js)
WordPress as the Backbone(.js)WordPress as the Backbone(.js)
WordPress as the Backbone(.js)
Beau Lebens
 
Rails 3: Dashing to the Finish
Rails 3: Dashing to the FinishRails 3: Dashing to the Finish
Rails 3: Dashing to the Finish
Yehuda Katz
 
Laying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme developmentLaying the proper foundation for plugin and theme development
Laying the proper foundation for plugin and theme development
Tammy Hart
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
Hisateru Tanaka
 
Using and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middlewareUsing and scaling Rack and Rack-based middleware
Using and scaling Rack and Rack-based middleware
Alona Mekhovova
 
WordPress Plugin development
WordPress Plugin developmentWordPress Plugin development
WordPress Plugin development
Mostafa Soufi
 
Caldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW WorkshopCaldera Learn - LoopConf WP API + Angular FTW Workshop
Caldera Learn - LoopConf WP API + Angular FTW Workshop
CalderaLearn
 
WordPress for developers - phpday 2011
WordPress for developers -  phpday 2011WordPress for developers -  phpday 2011
WordPress for developers - phpday 2011
Maurizio Pelizzone
 
Digging into WordPress custom fields - WordCamp Brno 2017
Digging into WordPress custom fields - WordCamp Brno 2017Digging into WordPress custom fields - WordCamp Brno 2017
Digging into WordPress custom fields - WordCamp Brno 2017
Magdalena Paciorek
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
Bo-Yi Wu
 
Developing Plugins For WordPress
Developing Plugins For WordPressDeveloping Plugins For WordPress
Developing Plugins For WordPress
Lester Chan
 
20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev20130528 solution linux_frousseau_nopain_webdev
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
How Not to Build a WordPress Plugin
How Not to Build a WordPress PluginHow Not to Build a WordPress Plugin
How Not to Build a WordPress Plugin
Will Norris
 
Introduction to backbone presentation
Introduction to backbone presentationIntroduction to backbone presentation
Introduction to backbone presentation
Brian Hogg
 
Ad

More from Paul Bearne (6)

WP json api
WP json apiWP json api
WP json api
Paul Bearne
 
Unit tests with vagrant
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrant
Paul Bearne
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
Paul Bearne
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
Paul Bearne
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and How
Paul Bearne
 
Author Avatars List demo slides
Author Avatars List demo slidesAuthor Avatars List demo slides
Author Avatars List demo slides
Paul Bearne
 
Unit tests with vagrant
Unit tests with vagrantUnit tests with vagrant
Unit tests with vagrant
Paul Bearne
 
How To Set a Vagrant Development System
How To Set a Vagrant Development SystemHow To Set a Vagrant Development System
How To Set a Vagrant Development System
Paul Bearne
 
HirshHorn theme: how I created it
HirshHorn theme: how I created itHirshHorn theme: how I created it
HirshHorn theme: how I created it
Paul Bearne
 
WortdPress Child themes: Why and How
WortdPress Child themes: Why and HowWortdPress Child themes: Why and How
WortdPress Child themes: Why and How
Paul Bearne
 
Author Avatars List demo slides
Author Avatars List demo slidesAuthor Avatars List demo slides
Author Avatars List demo slides
Paul Bearne
 

Recently uploaded (20)

Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Download YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full ActivatedDownload YouTube By Click 2025 Free Full Activated
Download YouTube By Click 2025 Free Full Activated
saniamalik72555
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Requirements in Engineering AI- Enabled Systems: Open Problems and Safe AI Sy...
Lionel Briand
 
Exploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the FutureExploring Wayland: A Modern Display Server for the Future
Exploring Wayland: A Modern Display Server for the Future
ICS
 
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and CollaborateMeet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Meet the Agents: How AI Is Learning to Think, Plan, and Collaborate
Maxim Salnikov
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
FL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full VersionFL Studio Producer Edition Crack 2025 Full Version
FL Studio Producer Edition Crack 2025 Full Version
tahirabibi60507
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 

Using WordPress as your application stack

  • 1. Using WordPress as your application stack WHY AND HOW
  • 2. @me Senior Full Stack WordPress Developer Plugin author of Author Avatars List http://wordpress.org/plugins/author-avatars/ and WP Site Verification tool http://wordpress.org/plugins/wp-site-verification-tool/ Slides @ http://www.slideshare.net/pbearne
  • 3. Why WordPress? •Stable •Supported •Community •Scales
  • 4. Why not WordPress? •Code debt •PHP •Has PHP global’s •Not sexy
  • 5. 23% OF THE SITES IN WHOLE INTERNET
  • 8. How •Actions and filters •JSON API •jQuery - Backbone •Template hierarchy •Custom post types
  • 9. Filter add_filter(‘fliter_name’, ‘function_to_run’); Function function_to_run( $var ){ $var .= ‘hello world’; return $var; } http://codex.wordpress.org/Plugin_API#Filters
  • 10. Action add_action(‘action_name’, ‘function_to_run’); Function function_to_run( $var = null ){ echo ‘hello world’; } http://codex.wordpress.org/Plugin_API#Actions
  • 11. Ajax Route /** * Register a rewrite endpoint for the API. */ function prefix_add_api_endpoints() { add_rewrite_tag( '%api_item_id%', '([0-9]+)' ); add_rewrite_rule( 'api/items/([0-9]+)/?', 'index.php?api_item_id=$matches[1]', 'top' ); } add_action( 'init', 'prefix_add_api_endpoints' ); https://10up.github.io/Engineering-Best-Practices/php/#ajax-endpoints
  • 12. Ajax handler function prefix_do_api() { global $wp_query; $item_id = $wp_query->get( 'api_item_id' ); if ( ! empty( $item_id ) ) { $response = array(); // Do stuff with $item_id wp_send_json( $response ); } } add_action( 'template_redirect', 'prefix_do_api' );
  • 13. JSON API wordpress.com Part of the Jetpack plug-in http://developer.wordpress.com/docs/api/ https://developer.wordpress.com/docs/api/console/ End point https://public-api.wordpress.com/rest/v1/ e.g. https://public-api. wordpress.com/rest/v1/sites/authoravatars.wordpress.com/
  • 14. JSON API wp.org (self host) Part of next version of core (currently plug-in) http://wp-api.org/ End point https://domain.com/wp-json/
  • 15. JSON API wp-api.org/ v. WP.com WP.com Wp-api.org Caching On you server Little load on your servers Extendable Access to WordPress.com user and stats More complete The API’s don’t match (yet)
  • 16. BackBone Included with WordPress  To just load it wp_enqueue_script( ‘backbone’ ); Or better still load as a dependency of your script wp_enqueue_script( ‘myscript’, ‘path/to/script, array( 'backbone' ) ); https://github.com/tlovett1/_s_backbone
  • 17. Template Hierarchy The order Wordpress load its template files http://codex.wordpress.org/Template_Hierarchy
  • 19. Custom post types The main logical data object in WordPress The standard types are : post, page, media add_action( 'init', 'create_post_type' ); function create_post_type() { register_post_type( 'acme_product', array( 'labels' => array( 'name' => __( 'Products' ), 'singular_name' => __( 'Product' ) ), 'public' => true, 'has_archive' => true, ) ); } http://codex.wordpress.org/Post_Types
  • 20. Custom metadata The data linked to a post object Text or serialized data Use CMB2 to easily create admin forms Hide the metadata from admin by starting the id with an “_” $meta_boxes[ 'tombstone_page_metabox' ] = array( 'id' => __( 'tombstone_page_metabox', Config::get_text_domain() ), 'title' => __( 'Tombstone Details', Config::get_text_domain() ), 'object_types' => array( self::get_tombstone_post_type() ), https://github.com/WebDevStudios/CMB2 // Post types 'context' => 'normal', 'priority' => 'high', 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => __( 'Tag line', Config::get_text_domain() ), 'desc' => __( 'Enter the pull Quote', Config::get_text_domain() ), 'id' => Config::_get_prefix() . 'tagline', 'type' => 'textarea_small', 'attributes' => array( 'style' => 'width:100%;', ), ), ) );
  • 21. Call external API and cache Use the internal wp_remote_get() get remote data. Then cache the data with a transients cache or tlc_transient() $request = wp_remote_get('http://example.com'); $response = wp_remote_retrieve_body( $request ); echo $response; <?php // Define your callback (other examples use this) function my_callback() { return wp_remote_retrieve_body( wp_remote_get( 'http://example.com/feed.xml', array( 'timeout' => 30 ) ) ); } // Grab that feed echo $data = tlc_transient( 'example-feed' ) ->updates_with( 'my_callback' ) ->expires_in( 300 ) ->get(); If( false != $data ){ // show data } ?> https://github.com/markjaquith/WP-TLC-Transients