Last night, I presented at the local Milwaukee WordPress Meetup on Custom Post Types, Custom Taxonomies, and Custom Fields. These are very power features of WordPress that can allow you to do some pretty amazing things with the software.
Custom Post Types, Custom Taxonomies, and Custom Fields are major parts of what can unlock the true potential of WordPress as a full-fledged content management system. For a good overview of WordPress as a CMS, I recommend Aaron Holbrook‘s talk titled “WordPress is a CMS, Dammit!” [Slides | Video from WordSesh]
During our meetup presentation, I walked through setting up an employee listing feature for a site including the following info:
- Custom Post Type: Employees
- Custom Taxonomy: Departments
- Name Field (Title)
- Bio Field (Content Editor)
- Job Title (Custom Text Field)
- Certifications (Custom Repeater Field)
- Start Date (Custom Date Picker Field)
- Photo (Custom Image Field)
- PDF of Bio (Custom File Upload Field)
We talked briefly about the WordPress Template Hierachy (and I even gave out some of Michelle Schulp’s template hierarchy posters from WordCamp Chicago). Based on this, we created and edited archive-wpmke_employee.php and single-wpmke_employee.php to create some custom templates that displayed our post type and custom fields.
Overall, I believe everyone learned a thing or two. There is a lot you can do with custom posts, custom taxonomies, and custom fields that I couldn’t touch on in my 1hr+ presentation. Below are some resources from the meetup presentation and discussion.
- Github Gist including the Generated Code and template file from the demo – I have cleaned up and commented to make it more easily readable.
- AdvancedCustomFields.com – Check out the documentation and add-ons. I recommend at least getting the repeater field.
- Advanced Custom Fields WordPress Plugin Repo
- GenerateWP – Custom Post Type, Custom Taxonomy, and other code generators
- Codex entry on Custom Post Types
- Codex entry on Custom Taxonomies
- Custom Post Type UI Plugin – Create CPTs with a plugin
- PHP Code to create custom meta boxes and fields