Last active
August 29, 2015 14:01
-
-
Save TooTallNate/e074d971d1db51a25cd9 to your computer and use it in GitHub Desktop.
wpcom.js example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="wpcom.js"></script> | |
<script> | |
// create a client WPCOM instance | |
var wpcom = WPCOM(); | |
// retrieve a listing of the most recent | |
// 5 posts on "en.blog.wordpress.com" | |
wpcom | |
.site('en.blog.wordpress.com') | |
.postsList({ number: 5 }, function(err, data) { | |
if (err) throw err; | |
console.log('the newest 5 blog post titles are:\n'); | |
data.posts.forEach(function(post, i) { | |
console.log(' %d: "%s"', i+1, post.title); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment