Example of using WordPress 4.7+ REST API with (universal) Javascript
- Clone this repo
- Run
npm install
to get dependencies - Then
npm start
and open a browser tolocalhost:8080
npm start
copy required files and starts a static webserver on the ./public folder.
npm run dev
as above plus starts Webpack in watch mode for Javascript files in the ./src folder.
npm run deploy
one-shot compile of Webpack, copy CSS files in the ./public folder and then commits and push it on the gh-pages branch.
WordPress team has recently released version 4.7 of their application, which officially introduce the REST APIs as a core functionality, moving the whole WordPress development experience torwards the Project Calypso as happens now on wordpress.com websites.
This repo aims to give a real example on how to use WordPress REST API in Javascript especially for old-school theme developers.
Just a (new) naming convention, read more on this post.
None. Since this is a quick example I have wrote a couple of quick'n'dirty utilities to keep the main file code clean.
The focus in this example is on how to interact with data on a WordPress site in a RESTful way rather than showcase how to do it in framework X or Y.
https://moebiusmania.github.io/wpapi-js/
Released under the MIT license.