This is an excellent plugin, it's saving me heaps of time, so thank you.
I just wanted to share my adaptation of this plugin in case anyone else wants to use this with a theme that uses a custom field for the Thumbnail instead of the featured image (such as Elegant Themes).
Edit automatic-featured-image-posts/automatic-featured-image-posts.php and replace /* Assign the featured image */ and everything there after with the code below, which will:
- Disable setting a featured image.
- Automatically attach the image to the new post.
- Automatically add the attached image's url to a custom field called Thumbnail
What I would really like to do next is get the plugin to automatically populate the eshop fields to make the post a product in the eshop store. Initially this seemed like it would be a simple case of adding a post_meta record, but it has transpired to be a bit more involved. If anyone cracks it then please let me know.
I hope this is useful to some of the other photographers out there using WordPress.
/* Assign the featured image */ /* update_post_meta( $new_post_id, '_thumbnail_id', $post_id ); */ // Update attached image $my_post = array(); $my_post['ID'] = $post_id; $my_post['post_type'] = 'attachment'; $my_post['post_mime_type'] = 'image/jpeg'; $my_post['post_parent'] = $new_post_id; // Update the post into the database wp_update_post( $my_post ); /* Populate the custom Thumbnail field */ update_post_meta( $new_post_id, 'Thumbnail', wp_get_attachment_url( $post_id ) ); /* Populate the eshop product field defaults */ //This is a planned future development. }