a library that help to fetch wordpress blog that has JSON API plugin installed on it.
will be soon added to bower, see issue 13
- download the zip file
- uncompressed it
- move the libs folder on you project
- enjoy!
<div id="content">Here will be the raw json output </div>
<script type="text/javascript" src="PATH_TO_FOLDER/libs/wpjson.js"></script>
<script type="text/javascript">
wpj = new wpjson("http://YOUR_WORDPRESS_SITE");//create a wpjson object
//request recent articles (just an example)
wpj.fetchPosts(wpj.METHOD_RECENT_POST, 1, function(result) {
content = document.querySelector("#content");
content.innerHTML = "<strong>" + result.status + "</strong>";
});
</script>
- METHOD_RECENT_POST : "get_recent_posts" method of JSON API
- METHOD_POSTS_LIST : "get_posts" method of JSON API
- SEARCH_POSTS : "get_search_results" method of JSON API
there are new method coming, for more information watch the evolution of the milestone
This project is under the apache license.
Find the license here
