This tutorial will guide you to create your own custom post composing form to enable fast blogging with your favorite theme without adding a plugin. I’m looking for any alternative to not porting P2, however…. none., finally that’s the reason i wrote it, and It was also inspired by the original development from http://wpshout.com/wordpress-submit-posts-from-frontend/.
I found the code from http://wpshout.com/wordpress-submit-posts-from-frontend/ , but it doesn’t handle file attachment, indeed most people and I was demand on image uploads for status update, photo blogging.. whatever . But to get working with build-in WordPress media upload function require a lots of code work, and if you prefer a fully functional media library, you could base on P2 theme instead.
How it work
- It create a post form to allow the post content inserted by wp_insert_post.
- following the post_id, it attach the uploaded files to the post.
- Set the first ordered image to the post “featured images”
- Lastly, you call get_all_thumbnails before the_content() in order to retrieve the uploaded files.
The critical limitation is lack of media features, unlike build-in media library, you can customize your post images and place it on your desired position. Therefore the images only able to retrieve by the_post_thumbnail() for single image or get_all_thumbnails() for multiple images.