親指の画像で新しい投稿を追加しようとしていますが、まだ成功できませんでした。
public static int addContent(int postType, string title, string body, string post_thumbnail, string[] categories, string[] tags, DateTime dateCreated)
{
Post post = setPost(postType, title, body, post_thumbnail, categories, tags, dateCreated);
using (var wrapper = getWordPressWrapper())
{
return wrapper.NewPost(post, true);
}
}
setPost メソッドを取得し、
public static Post setPost(int postType, string title, string body, string post_thumbnail, string[] categories, string[] tags, DateTime dateCreated)
{
string type = postType == 1 ? "post" : "page";
var customFields = new CustomField[] {
new CustomField() {
// Don't pass in ID. It's auto assigned for new custom fields.
// ID = "name",
Key = "post_thumbnail",
Value = post_thumbnail
}
//,
// new CustomField() {
// // Don't pass in ID. It's auto assigned for new custom fields.
// // ID = "name",
// Key = "post-thumbnail",
// Value = post_thumbnail
//} ,
// new CustomField() {
// // Don't pass in ID. It's auto assigned for new custom fields.
// // ID = "name",
// Key = "post-thumbnails",
// Value = post_thumbnail
//} ,
// new CustomField() {
// // Don't pass in ID. It's auto assigned for new custom fields.
// // ID = "name",
// Key = "thumbnail",
// Value = post_thumbnail
//}
};
return new Post
{
PostType = type,
Title = title,
Body = body,
Categories = categories,
Tags = tags,
DateCreated = dateCreated,
CustomFields = customFields
};
}
ご覧のとおり、コメントされています。親指の画像を投稿するためにあらゆることを試みました。
post_thumbnail、post-thumbnail、post-thumbnails、thumbnail キーを試しましたが、何も起こりません。
どうやってやるの?