I’m working on a project where I’ll need to add a simple custom post type. I could hand code it, but it’s just such a chore to do, that I decided to use one of the various plugins designed to make the chore much less annoying. For this project, I chose Easy Content Types. It was really pretty simple. There was only a couple of things that threw me for a momentary loop, but both were resolved quickly. I’ll mention them as I get to them in the process below. So here’s how I quickly created a custom post type for the staff members of a school. (I used myself as an example, but I’m definitely not a staff member anywhere).
Install Is Typical
After I purchased the plugin ($39), I clicked Plugins > Add New, and uploaded the plugin. It then asked me for my license code, and then I had new admin menu items as shown above.
Help Is Abundantly Available
As you can see from above images, there is lots of help – everything from general tips on understanding custom post types, taxonomies, and meta boxes, to specific “how to” instructions for everything you might want to do with the plugin.
One of the things you’ll notices in the first image above is the section on Theme Templates. I wanted to point this out, because it was a prime reason I chose this plugin. It automatically sets up WordPress theme template files for post types and taxonomies. Big time-saver for me there!
Creating A Custom Post Type
Create custom post typeNow it was time to create my Staff Members custom post type. It was ridiculously simple to accomplish. I typed in “staffmembers”, “Staff Member”, and “Staff Members” in each of the three respective fields shown above and was done. I left all of the Advanced Labels and Advanced Settings as default, as they were fine as they were.
Creating A Taxonomy
Create a taxonomyI needed to categorize the staff members by Department, so I created a custom taxonomy for that. It was as simple as creating the custom post type.
Creating A Metabox
Finally, I need to have a job title for each staff member, so I created a metabox. I think you get the picture now that each of these things are super-simple to create.
Add The First Staff Member
Adding the first staff member was a breeze. Typical editor screen. Staff member’s name went in the “title” area, her bio went in the normal content area, and I entered her Job Position in the jobtitle meta box. I uploaded her photo as the Featured Image and clicked the Publish button.
The First Problem
Here’s where I encountered the first problem. The staff member’s page returned a 404! Yikes! Where did I go wrong? Well, honestly, I don’t think it was anything I did, as far as I can tell, but the solution to the problem was a simple one. I simply went to Settings > Permalinks and clicked the Save Changes button. (I didn’t have to actually change anything. Merely clicking the Save Changes button is all it takes to reset things and make permalinks work correctly at times).
Once I got that resolved, I added the rest of the staff members (and myself for demo purposes, as you’ll see next).
A Few Custom CSS Tweaks Later…
As I mentioned, Easy Custom Types automatically creates template files, which is a huge time-saver. But that doesn’t mean I wanted the design exactly the way it created it. I wanted to make a few changes to the layout and typography, so I added a little custom CSS as you can see in the image above. Those three little tweaks were all I needed to make my page exactly the way I wanted it to be.
The Second Problem Emerged
The second problem was actually a user issue. In other words, I momentarily got confused. I was assuming the URL of the archives page was the same as the theme template file name. Don’t ask me why I thought that. My brain just went on vacation for a few minutes, I guess. When it returned, I realized that the archives page was simply mydomain.com/staffmembers (the name of my custom post type). Duh.
A Bonus Cool Feature
So, that was that! It took a LOT longer to take screenshots and write this post than it did to create my custom post type, taxonomy, and metabox, and populate it all with data. But there is one more feature that is very cool, though I haven’t had to use it yet. Easy Content Types also has an export feature that is as easy to use as …well … everything else. Just go to the Export section, and as you can see from the image above, it literally says to copy and paste the code it gives you into another theme’s functions.php file. Doesn’t get much easier than that.
So, this plugin was a success for my project. It was as easy to use as its name implies. I had two “issues” with it. One was quickly resolved by resaving permalinks, and the other was just my complete brain fart. (Am I allowed to use that phrase? Well, I did, so…ok).
That’s all there is to know. It works. It’s easy. Get it at ThemeIsle.
Tags: custom post type, metabox, plugins, taxonomy, wordpress