WordPress Custom Post Types: Definition and Usage

WordPress Custom Post Types: Definition and Usage - The White Label Agency

We build a lot of WordPress sites. It’s all we do. Most times we are working on someone else’s design. Many graphic designers are getting into website design for the first time. They are unfamiliar with WordPress custom post types. Using WordPress custom post types is an important tool for any website design.

What are WordPress custom post types?

WordPress is outstanding at storing and displaying many different types of content. Within the WordPress structure, a single item of content is generally called a post. This can be a little confusing because one of the post types is “post”. In the WordPress database, all of the post types are stored in the same place … the wp_posts database table. They are differentiated by a column called post_type. With the advent of WordPress 3.0 came the capability to add your own custom post types and use them in specific and interesting ways.

There are five default post types that are available to developers:

  1. Post (Post Type: ‘post’)
  2. Page (Post Type: ‘page’)
  3. Attachment (Post Type: ‘attachment’)
  4. Revision (Post Type: ‘revision’)
  5. Navigation menu (Post Type: ‘nav_menu_item’)

A custom post type can be added to WordPress via the register_post_type() function. This function allows you to define a new post type by its labels, supported features, availability and other specifics. A simpler way to do it is via the fantastic CPT UI plugin. When coupled with the equally fantastic Advanced Custom Fields plugin, creating powerful architectures based upon WordPress custom posts types is a breeze.

What are some examples of WordPress custom post types?

My favorite example to use is the “our team” page on a site for a law firm or an agency of some sort. I use our own TWLA About page here. The individual posts (see image with caption “Single”) have custom fields which capture data points like title, contact info, etc. A custom design which differs from the basic single.php layout is applied to this template. The posts can then be pulled dynamically onto an archive (see image with caption “Archive”). If a new post is added it appears in archives automatically. If an existing post is marked as a draft or gets deleted, it disappears from the archives it is in. This makes it very simple for a novice administrator to manage the site.

WordPress Custom Post Types Important Reference Links