/wp-rest-jquery

A jQuery wrapper around the WordPress REST API for use in any jQuery written web app.

Primary LanguageJavaScript

jQuery WordPress REST API Wrapper

This jQuery plugin provides a wrapper arround the WordPress REST API and can be used in any jQuery project.

Instalation

Simply copy the file into your project and replace YOUR_API_ENDPOINT with the correct URL. e.g. http://www.danillo.nl/wp-json/wp/v2

Usage

wp.posts()
	.done(function(posts){
		// Loop through the posts
		$(posts).each(function(){
			console.log(post.title.rendered);
			console.log(post.content.rendered);
		});
	})
	.fail(function(){
		console.log('Oops something went wrong');
	});
}

Documentation

For a more extended documentation go to the WordPress REST API Reference documentation at http://v2.wp-api.org/reference/

Posts

wp.posts([params])

Pages

wp.pages([params])

Media

wp.media([params])

Comments

wp.comments([params])

Categories

wp.categories([params])

Taxonomies

wp.taxonomies([params])

Tags

wp.tags([params])

Users

wp.users([params])