如何使用node-wordpress的例子
我想用node-wordpress库运行wordpress RPC方法,但是因为没有任何文档,所以我不知道运行它的正确方法是什么。
如果你有机会一起工作,你能举一些例子吗?
我设法通过阅读模块本身来完成它。
首先你启动客户端:
var wp = wordpress.createClient({ "url": 'http://yourwordpressURL', "username": 'user', "password": 'pwd' });
比添加一个post,例如,只需进行以下调用:
wp.newPost({ title: 'Your title', status: 'publish', //'publish, draft...', content: '<strong>This is the content</strong>', author: 3, // author id terms: {'category': [category_id]} }, function() { console.log(arguments); } });
所有wordpress的文档在http://codex.wordpress.org/XML-RPC_WordPress_API/Posts
希望有所帮助。