the future of wordpress and javascript
TRANSCRIPT
![Page 1: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/1.jpg)
The Future of WordPressand JavaScript
WordPress CincinnatiMarch 2016
![Page 2: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/2.jpg)
OUTLINE• History of JavaScript
• How JavaScript is used in WordPress
• Benefits of JavaScript
• Speculating the future of WordPress
• Demo
![Page 3: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/3.jpg)
Learn JavaScript, Deeply“ — Matt MullenwegState of the Word, WordCamp US 2015
![Page 4: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/4.jpg)
HISTORY OF JAVASCRIPT
![Page 5: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/5.jpg)
HISTORY OF JAVASCRIPT
• Created by Brendan Eich
• Developed over the span of ten days in May 1995
• Introduced in Netscape Navigator 2.0 (September 1995)
![Page 6: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/6.jpg)
WHAT IS JAVASCRIPT?• One of the three essential technologies of
the web (the others being HTML and CSS)
• Supported by all major web browsers without plugins
• Standard maintained by Ecma International, currently version 6 (ECMAScript 2015)
![Page 7: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/7.jpg)
WHAT IS JAVASCRIPT?var API_ROOT = ‘https://andrewduthie.com/wp-json';function getPosts( callback ) {
var xhr = new XMLHttpRequest();xhr.open( 'GET', API_ROOT + '/wp/v2/posts' );xhr.onreadystatechange = function() {
var posts, error;if ( 4 === xhr.readyState ) {
try {posts = JSON.parse( xhr.responseText );
} catch ( e ) {error = e;
}
callback( error, posts );}
};xhr.send();
}
![Page 8: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/8.jpg)
WHAT IS JAVASCRIPT?
import { API_ROOT } from 'config';
export default async function getPosts() {const response = await fetch( `${ API_ROOT }/wp/v2/posts` );return await response.json();
}
![Page 9: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/9.jpg)
JAVASCRIPT IN WORDPRESS
![Page 10: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/10.jpg)
JAVASCRIPT IN WORDPRESS
![Page 11: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/11.jpg)
<?php
function mytheme_scripts() {$theme_dir = get_template_directory_uri();wp_enqueue_script(
'mytheme-script', // Unique name$theme_dir . '/script.js', // Script URLarray( 'jquery' ), // Dependencies'v1.4.1', // Versiontrue // In footer
);}add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );
JAVASCRIPT IN WORDPRESSIncluding your own scripts
https://codex.wordpress.org/Using_Javascript
![Page 12: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/12.jpg)
BENEFITS OF JAVASCRIPTInteractivity
![Page 13: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/13.jpg)
BENEFITS OF JAVASCRIPTPerceived Speed
• Display content optimistically
• Artificial content can give users the perception of speed
![Page 14: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/14.jpg)
JAVASCRIPT’S SURGE IN POPULARITY
Better tooling for large applications
Frameworks lower barrier to entry
Same language everywhere with Node.js
Language and browser improvements
![Page 15: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/15.jpg)
THE FUTURE OF WORDPRESS
= ???+
![Page 16: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/16.jpg)
CALYPSO
![Page 17: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/17.jpg)
WP-API
![Page 18: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/18.jpg)
WP-ADMIN 2.0Note: This is not it
![Page 19: The Future of WordPress and JavaScript](https://reader031.vdocument.in/reader031/viewer/2022030318/5a6cf3b67f8b9a1b428b4807/html5/thumbnails/19.jpg)
LIVE DEMO