Skip to content
This repository has been archived by the owner on Feb 19, 2020. It is now read-only.

Latest commit

 

History

History
42 lines (29 loc) · 910 Bytes

wpcom.md

File metadata and controls

42 lines (29 loc) · 910 Bytes

WPCOM

WPCOM('token');

Create a new instance of WPCOM. token parameter is optional but it's needed to make admin actions or to access to protected resources.

Note: You can use the [node-wpcom-oauth][] module to get an access token.

WPCOM#me(fn)

Create a Me object. More info in Me doc page.

var wpcom = require('wpcom')('<your-token>');
var me = wpcom.me();
});

WPCOM#site('site-id')

Create a Site object. More info in Site doc page.

var wpcom = require('wpcom')('<your-token>');
var site = wpcom.site();

WPCOM#freshlyPressed([params, ]fn)

View Freshly Pressed posts from the WordPress.com homepage.

wpcom.freshlyPressed(function(err, data){
  if (err) throw err;
  console.log('"Freshly Pressed" Posts:');
  data.posts.forEach(function (post) {
    console.log('  %s - %s', post.title, post.short_URL);
  });
});