I’ve been through the gamut of tutorials on creating custom post types for WordPress, and some of them are excellent, really excellent. But a while ago I came across some code, and for the life of me I can’t remember where I got it (lesson learned to add the source to every code snippet I find), that makes building custom post types a lot easier… Instead of having to create each custom post type separately you just add a variable for each new post type and let the code do the rest. (and, just quietly the adding the icon bit is all my handiwork)
This code goes into your functions.php file – and to add as many different custom post types as you like, simply add new fields to that first array’where the magic happens’…
Edited to add, a note on the icon name… calling it the name generated by the $plural variable will output code expecting the image to be called (in the case of the portfolio item below) PortfolioItems.png – it’s case sensitive and removes spaces.
If you want to take this even further, couple it with Jared Atchison (and Bill Erickson’s) Custom Metaboxes for WordPress library and creating Metaboxes and Kick Ass Custom Post Types (without plugins) gets a whole lot easier!