I've made a quick PHP script/page that uses the wp_insert_post() function to insert a post directly. And this works great. The post I am manually adding has an image in it, so I firstly manually/programatically upload the image to the respective "/uploads/" folder where all my post images are saved (btw im not using year/month sub-directories). The content of the post has normal text, plus the necessary HTML to point to the image too, eg.
<p>This is a manually created post for my blog, there should be a picture below this line of text. Thanks for visiting.</p>
<img src="http://www.mysite.com/wp-content/uploads/image.jpg">
The post appears fine (including the image). But my 2 problems are:
1) The image I uploaded is not in the Media Library, How do I get it in there?
2) I would like to add a "featured image/thumbnail" to the same image, but I dont know what function is used to make that call? I was hoping to find a function along the lines of insert_featured_thumbnail("/wp-content/uploads/image.jpg", $pid)
Does anyone have any ideas?
Thanks in advanced.
WizzKidd