4
我想用node-wordpress庫來運行wordpress RPC方法,但由於沒有任何文檔,我不確定運行它的正確方法是什麼。如何使用node-wordpress的示例
如果你有機會使用它,你能舉一些例子嗎?
我想用node-wordpress庫來運行wordpress RPC方法,但由於沒有任何文檔,我不確定運行它的正確方法是什麼。如何使用node-wordpress的示例
如果你有機會使用它,你能舉一些例子嗎?
我設法通過閱讀模塊本身來完成它。
首先啓動客戶機:
var wp = wordpress.createClient({
"url": 'http://yourwordpressURL',
"username": 'user',
"password": 'pwd'
});
比增加後,例如,只要下面的調用:
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
希望有所幫助。
這節省了我約3小時的麻煩拍攝。乾杯! – 2013-11-08 01:33:25