Why Do You Need Custom Post Types?

If you are a client, and not a WordPress developer or designer, you may not know what Custom Post Types are, and certainly not why you might need them on your site. And if you’re a blogger, with nothing more on your mind than just blogging, Custom Post Types, may not be a thing for you at all. But maybe you’ve struggled with organizing your content in WordPress, and wondered why.

This is, I hope, the first in a series of posts about Custom Post Types and how magically awesome I think they are. Today is intended to be an overview and an introduction to the idea of creating new kinds of content in WordPress.

If you’ve used WordPress, you know that you add content to your site in one of two ways:

  • Posts: content which is arranged by date
  • Pages: content which is arranged in a hierarchy

If you blog, most often you are adding content to your site in the form of posts. Posts stream through your site by date, and the newest shows at the top, or front of your site. Posts show in RSS feeds, and can be sent out by email as part of a feed. Pages are static content–this is content which exists regardless of time, and probably doesn’t change often, such as a Contact or an About page.

But what about content that doesn’t quite fit into a Post or a Page?

For example: you’re a small business with a staff, and you want your staff members to be on your site. You could add them all to a Page called “Our Fabulous Staff”, but if there are more than two or three of you, that gets a bit long, right? And it’s a bit of effort to make sure that each staff person’s photo is lined up correctly, and that everyone’s information is displayed the same. And then, if someone leaves your company, or you hire on a new person, you need to dig in and remove (or add) just that person, without breaking the layout, and making sure they show in the right order.

Or maybe you’re a Realtor with property listings you’d like to share. Do you mix those in with blog posts, if you blog, or create another unwieldy page? And how do you send new listings out by email?

Or you’re running a restaurant with a menu list, where each item needs to be named, described, categorized, and priced.

Or you’re a church with a staff and sermons and a board of elders and a nursery schedule and mission partners…it can get pretty complicated quickly, right?

On a simpler scale, what if you’re a blogger and would like to share a page of resources with images and links, and maybe descriptions?

There’s a Pattern Emerging

These scenarios are all common, and one thing they all have in common is that they’re content which doesn’t quite fit into either a Post or a Page. They all tend to follow a certain internal pattern as well. Staff members might need to display names, titles, photos, email addresses, phone numbers, and a brief bio. Mission partners might need a description, photo/logo, contact information, and a link to their own website.

In these cases, it’s important that each staff member, mission partner, restaurant menu item, and so on, all look the same on the front end of the website, with the information arranged the same way for each person/partner/item.

It’s also important that it be easy to add and remove any of these items.

#doingitwrong

Staff Page Created by Hand
A staff page, created by hand, and a nightmare to edit. I’m truly sorry for what I did.

In my sordid past, I have one memorable staff page I built, with nifty thumbnails and fade effects, entirely by hand. The first problem with this is that the page had to be built in the text editor; if you dared switch to the visual editor, everything broke. The second problem with this is that if someone left the staff, the code which made up their entry had to be carefully extracted from the text–in two different places–and, more likely than not, the layout would break again. I told you this was out of my sordid past, didn’t I? To top it all off, even the styling had to be updated by hand, and required very specific rules, so if a new staff member was hired, the person managing the site had to actually dig into the CSS files and update those. And if someone wanted to update their bio? Ouch! (In my defense, at the time, it was a helpful way to solve the issue, and I simply didn’t know a better way to handle it.)

There Is a Better Way

Male Chimp
If my 14 year old Male Chimp can handle entering WordPress content, I know my clients can, too.

As complex and issue fraught as that staff page was, I really liked it a lot, and thought there had to be a better way to accomplish the same thing, a way to build the nifty layout, but ensure that whoever had the task of managing the website could do so easily, without worrying about the layout. And for bonus points, maybe there would be a way to set it up so that without having to recreate a complicated arrangement every time, the average user (whom I like to call my Male Chimp, after my sometimes hardworking teenage intern) could update, add, or remove people, without needing to curl up sobbing in the corner.

In fact, I was right: there is a better way! It’s called Custom Post Types.

A Custom Post Type is a new kind of content for your site. Once you’ve created the Custom Post Type, it shows as a menu item, just like Posts and Pages. In fact, it works very much like a Post or Page, except that it is its own unique kind of content. It can be dated content, like a real estate listing or a sermon (or a Post). It can be static content, like a person or a restaurant menu item (or a Page). Depending on how it’s set up, your new Custom Post Type can be viewed as a single element, or in an archive, just like a list of posts. Or you can get fancy and change how the archive for that Custom Post Type looks, without affecting the rest of your site.

The key element is that the Custom Post Type is now a new section of content on your site, both on the front end, and in the admin (or back end) as well. This means that, in the case of my unruly staff page, I am able to create a Custom Post Type which I can display on a main staff page, in a very similar layout to what I’d accomplished when I built it entirely by hand.

Custom Post Types help you organize your tools content.

Staff as Custom Post TypesWith my Staff Custom Post Type, each person is a unique entry, just as if he/she were a Page. I can set up my Staff archive–the list of all the Staff–with my thumbnails and fade effects, but because I’m using a Custom Post Type, I can simplify my styling and scripts immensely, because WordPress is now handling the hard work of picking and choosing everything for me, and handling the layout. All I have to do is add the information for each person. I can even tell WordPress how to organize my staff–I like to line them up alphabetically by last name usually, but sometimes you need to organize them by a seniority in the company, and that’s doable as well.

Want to see some working examples of staff pages using Custom Post Types?

Possibly, the best part is that if I need to remove someone from the list, I can just delete their Staff Custom Post Type entry. That’s it. The Staff archive will reorganize automagically. If I need to add someone, I just create a new Staff Custom Post Type entry. That’s it. No crazy code in the text editor, no frightening styling changes, just as easy as adding a new blog post.

So, Who Really Needs Custom Post Types?

More of us need them than you might think. Here are some possible examples I’ve encountered recently:

  • a community theater wanting to display all the shows they’ve performed
  • a restaurant wanting to post their menu online
  • a Realtor needing to show real estate listings with links to the listing on an official MLS site
  • a church sharing sermons each week
  • a blogger sharing resources with Amazon affiliate links
  • a designer or artist displaying a portfolio
  • any business wanting to show their staff
  • a crafty person selling their wares
  • a teacher or coach posting course information

Those are just a few ideas, but I know there are more. Basically, if you have a kind of content which you use a lot, and which is resisting your efforts to shoehorn it into your site’s Posts and Pages, you are a candidate for Custom Post Types.

Reader Interactions

Comments

  1. Ginger says

    Good series Robin, I needed it 🙂 I’m embarrassed to admit sometimes CPTs befuddled me. Don’t tell anyone.

    • Robin says

      Nothing to be embarrassed about! I think they can be confusing, but once you start finding possible uses for them, you see them everywhere.

  2. Jodi Stammer says

    To echo Jose – this is very clear and concise … the best description I’ve seen. Thank you for taking the time to write it, and including great examples and screen shots!

  3. Chris Hobson says

    Great read Robin, well written, look forward to the next chapter!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.