1 |
|
2 | # WPCOM
|
3 |
|
4 | ### WPCOM('token');
|
5 |
|
6 | Create a new instance of WPCOM. `token` parameter is optional but it's needed to
|
7 | make admin actions or to access to protected resources.
|
8 |
|
9 | **Note**: You can use the [node-wpcom-oauth][] module to get an _access token_.
|
10 |
|
11 | ### WPCOM#me(fn)
|
12 |
|
13 | Create a `Me` object. More info in [Me doc page](./me.md).
|
14 |
|
15 | ```js
|
16 | var wpcom = require('wpcom')('<your-token>');
|
17 | var me = wpcom.me();
|
18 | });
|
19 | ```
|
20 |
|
21 | ### WPCOM#site('site-id')
|
22 |
|
23 | Create a `Site` object. More info in [Site doc page](./site.md).
|
24 |
|
25 | ```js
|
26 | var wpcom = require('wpcom')('<your-token>');
|
27 | var site = wpcom.site();
|
28 | ```
|
29 |
|
30 | ### WPCOM#freshlyPressed([params, ]fn)
|
31 |
|
32 | View Freshly Pressed posts from the WordPress.com homepage.
|
33 |
|
34 | ```js
|
35 | wpcom.freshlyPressed(function(err, data){
|
36 | if (err) throw err;
|
37 | console.log('"Freshly Pressed" Posts:');
|
38 | data.posts.forEach(function (post) {
|
39 | console.log(' %s - %s', post.title, post.short_URL);
|
40 | });
|
41 | });
|
42 | ```
|