user1589156
user1589156

Reputation: 41

Automatically Create Wordpress Posts for Each Photo in my Media Folder

When I'm designing Wordpress sites for clients, many of the theme designs I use consist of several posts, each with one photo and a bit of text. As a result, I end up spending lots of time creating lots of posts with one picture each-- just so the layout works as expected. It seems like there should be a way to bulk add images to the Media folder (I use the Add from Server plugin) and then tell WP to create a bunch of separate posts containing one photo each.

Does anyone know how to do this? It seems like professional theme designers would get a lot of use out of a plugin that did this automatically.

Thanks! Chimera

Upvotes: 1

Views: 2729

Answers (2)

Kiksy
Kiksy

Reputation: 1292

I looked around for a solution to this problem too, but just ended up writing my own plugin to do it.

Auto Create Posts From Images

If you wanted to do it yourself,

global $user_ID;
$new_post = array(
'post_title' => 'My New Post',
'post_content' => 'Lorem ipsum dolor sit amet...',
'post_status' => 'publish',
'post_date' => date('Y-m-d H:i:s'),
'post_author' => $user_ID,
'post_type' => 'post',
'post_category' => array(0)
);
$post_id = wp_insert_post($new_post);

and there is good info in the docs:

WP Docs

Upvotes: 1

janw
janw

Reputation: 6662

You could make a default set of images and export the sql records that go with it. So set up of a new site you could import both the files and the sql so you have images ready.

The functionality you want can be made, nextgen does scan it's folders.

Upvotes: 0

Related Questions