A few people have recently been asking how the NewPost method works within JoeBlogs
First, you need to create an instance of Post.
Then, set the following properties:
Fairly self explanatory, but you should set this to today’s date (or whatever date you wish the post to be set as published)
The title of the post
The body of the post.
This can of course contain HTML
This is a string array of categories to associate with the post
Another string array, representing the tags for the post
Then, using your presumably already instantiated Wrapper class, you can call the NewPost method, which takes the above Post object as a parameter, and a boolean – indicating if the post is to be set as published. Note – if this is set to false, the post is set in draft mode.
Here’s some sample code:
//create a new post var post = new Post(); //since this is a struct, we can't have a constructor that does this! post.dateCreated=DateTime.Now; post.title="This is a title"; post.description="this is the body of the post. it <strong>could</strong> be html."; //create the post! wp.NewPost(post,true);
Hope this helps!