I’m working on my first design project at the moment, and I feel as though the custom post types feature built into WordPress would be a good feature to use for part of the project.
Custom Post Types
Custom Post Types is a good feature as it allows a separate subset of posts to be stored together in the WordPress admin. The default WordPress Post types include Posts, Pages, Attachments, Revisions, and Nav Menus.
There are many good resources out there regarding the Post Types built into WordPress, however the best one I have seen is the WordPress Codex.
Custom Fields are likst adding post meta data to each post. Examples of uses for Custom Fields is:
- Mood: Joyous
- Now Reading: The Hunger Games
- Weather: Cold & Damp
For my project it is more along the lines of storing data in a similar fashion:
- President: Andrew B
- Phone Number: (02) 9000 0000
- Email: email@example.com
I feel that is a good use of custom fields.
Custom Post Types & Custom Fields
Combining both custom post types and custom fields is a good method to create posts of a similar nature, but allowing data to be stored associated with each post using custom fields.
The Code Required
There are plugins which create custom post types easily, however I prefer going down code in a plugin or theme to do the hard work. The following code is what I will be using for my custom project.
I don’t think that this is the prettiest solution, but it is one that definitely works.
Feel free to borrow any of my code, however please let me know where you use it, and whether you improve on it so that we both learn in a collaborative manner.
If you can potentially suggest a better solution, I would love to see your thoughts and comments.