tags:

views:

35

answers:

2

I have a script which collects an image, link and some text content from various sources. It loops through and creates a number of posts.

I'd like take each post add it to Wordpress with a Title, an image, and a link.

Can anyone suggest an easy way of doing this?

A: 

From the Wordpress function reference:

// Create post object
  $my_post = array();
  $my_post['post_title'] = 'My post';
  $my_post['post_content'] = 'This is my post.';
  $my_post['post_status'] = 'publish';
  $my_post['post_author'] = 1;
  $my_post['post_category'] = array(8,39);

// Insert the post into the database
  wp_insert_post( $my_post );

And the function to attach the image:

wp_insert_attachment( $attachment, $filename, $parent_post_id );

Jorge
A: 

Wordpress supports several APIs over XML-RPC.

http://codex.wordpress.org/XML-RPC_Support

It also supports posts via email, which might be simpler in your case.

http://codex.wordpress.org/Post_to_your_blog_using_email

Brendan Abel