Does anyone have any tips for creating an image-centric custom post type?
To elaborate, my blog has rotating header images, shown below:
The two images in the top left are randomized, and exist as attachments to a specific page that only exists to contain these images. I’m wondering if it’s feasible to store these in a different way using custom post types. I’ve created a new post type, “header-image”, and I’m trying to figure out where to go from here. I would like each header-image “post” to have one image attachment. Instead of pulling random images from a page, I would pull random posts from the header-image post type. Given this,
- How might I incorporate a simple interface to the attachment process that is available from the “New Header Image” admin page?
- Can I remove the post title and content input boxes to unclutter that page?
Goals are to create a better interface to the current upload process, and eventually be able to create a taxonomy to flag images as left picture/right picture. (Looking at the above image, you can see the photo on the right covers up the face in the other photo. I could avoid this by marking photos for left and/or right side display.) The latter won’t be a problem if I can implement the former.
Update: based on an answer here, I was able to implement this setup. Full code is posted below.
goldenapple’s initial answer gave me the jumpstart I needed to finish this up.
functions.php
Here is the complete code I’m using to add a new post type “header-image” and modify other admin screens accordingly:
Admin screenshots
Template code
That should register your post type with nothing but a field for a featured image. See the codex http://codex.wordpress.org/Function_Reference/register_post_type for a list of the arguments to pass.