Developer's Roundtable Notes

Session: Creating and Using Custom Post Types

Why CPTs?

An easy way to sort special purpose posts.

An easy way to add custom meta fields and re-arrange the edit screen – without affecting post and page edit screens.

Generally, just a cleaner way to add special posts without complicated queries.
(No need to exclude them from your normal blog page.)

Much simpler for clients to understand and manage.

Easy to create custom layout templates.

Category vs. CPT

When do you need a CPT?

Never need to integrate with posts

A completely different display

Need for custom fields

To make it simpler for client

Some Common Uses for CPTs



Staff Bios

Restaurant Menu Items

Events / Calendar Items

Recommended Links



CPT for FAQs

Create a custom post type for FAQs:


CPT for Staff Members

This is the code to create a custom post type for Staff.


Adding a Custom Taxonomy

This code creates a custom taxonomy for your CPT.


Adding Custom Fields

This code creates a custom meta box for the custom fields.


Template Magic

The magic of WordPress templates:

template-hierarchyJust name your template file correctly, and WP does the rest!

Single Page for Staff

Here is the code for displaying a single staff member. Name this page single-lt_staff.php.


Archive Page for Staff

Here’s the code for archive-lt_staff.php:


Archive Page by Taxonomy

To list staff members by their department, use this code for archive-lt_staff.php instead.


Put it into a Plugin

Because your client will be unhappy if they lose all their staff bios when they change to a new theme!

 One caveat here… the custom display pages (single-lt_staff.php and archive-lt_staff.php) need to be included in the theme files.

Skip to toolbar