- Download or Copy the plugin into your WordPress installation's plugins directory on your Local development machine
- Go to Plugins Dashboard. Activate the 'EASY-JS-WPAPI Client HANDLE for the WordPress REST-API'
Now, Go to Users menu on the WordPress dashboard. Add new User. Create a dummy Administrator profile,
complete with username, password and full name. e.g: username: 'matt', password: 'agba2700'
1. The Plugin is now activated, under it are the links: Settings | Deactivate | Edit
Now, Click on this Settings link OR on the WordPress Dashboard, Click on the "Basic WP-Authentication"
sub-menu of the Settings menu.
1. Enter the newly created dummy administrator username and its password. Click on the Save button
This username and password will be checked by the plugin to determine if it is a valid user,
and if it is a valid administrator user.
If the details you enter is correct, it displays the green unlock icon.
But if it is not, it displays the red lock icon, this tells you that you need to change
it to a valid admin username and password.
When the helper icon, displays a green unlock icon. You have finished setting up this plugin.
1. Go to your live production or development site. e.g:
http://talker-test.org or http://localhost:8080
1. Check your browser console: If your administrator's name is Matt, then you should see a console output:
"Hi! I am all set to talk with the WP REST-API.\n Best luck! on your WordPress Projects."
N.B:
- Mozilla Browser Console: Tools > Web Developer > Web Console
- Chrome Browser Console: More Tools > Developer Tools > Console
-
Open any .js script in your WordPress theme and start accessing the WP REST-API via the node-wpapi client
Example: // In a index.js controlling a index.php or index.html in a WordPress Theme
wp.posts().embed().get().then(function( response ) {
console.log( response );
//do something with returned data/response
});
-
Beginner Theme Developers should remember that all .js scripts in a WordPress Theme
must be enqueued in the Theme's functions.php
- See http://wp-api.org/node-wpapi/ for more info.