Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TooTallNate/e074d971d1db51a25cd9 to your computer and use it in GitHub Desktop.
Save TooTallNate/e074d971d1db51a25cd9 to your computer and use it in GitHub Desktop.
wpcom.js example
<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