Learn How to Create Custom WordPress Post Types
Don't do WordPress wrong! Learn about Custom Post Types.
Custom Post Types enhance the functionality of WordPress. They can also introduce some SEO benefits. This guide will help you create custom Post Types and give you an understanding of when and where to use them.
What is a WordPress Post Type
As defined by the Wordpress knowledgebase:
WordPress can hold and display many different types of content. A single item of such a content is called a post, although "post" is also a specific post type. Internally, all the post types are stored in the same place, in the wp_posts database table, but are differentiated by a column called post_type.
In short, a Post Type is a container of content. The content can be displayed on a page using a template, used by Widgets or Plugins, to generate content via dynamic media. Post Types can also be configured differently from the default WordPress supplied Post Types.
Why Use Custom Post Types?
Of late we have served many clients who brought to us a WordPress website that was not serving them well. Their website content was poorly organized and many suffered poor SEO scores as a result. One aspect that was common among their websites was they were using WordPress "page" nodes (the WordPress Page post type) for content such as testimonials, photos galleries, and common theme content.
Why is this bad? This content was never intended to for use on a single page. The theme uses these content nodes to create scrolling testimonial and photo gallery widgets displayed on the home page only. Because this content was added using default WordPress 'page' post type, the content was included in the XML sitemap with indexable URLs containing thin content. Learn more about why thin content is BAD.
We fixed these sites by moving this content to their custom post types. This allowed us to remove these content nodes from the XML sitemap easily by configuring Yoast SEO to exclude the custom post types we created. It also added a level or content organization to their sites; keeping page and theme/widget data content separate.
What other benefits to custom post types have? For starters, they can have Taxonomies, generate archives page, be excluded from internal searches and much more.
How to Create Custom Post Types
WordPress does not offer a native UI editor/creator for Post Types. With some advanced WordPress know-how, you can modify the functions.php file to define and register them there. I won't go into the advanced aspect today, let's learn the easy way!
Several WordPress Plugins are available that allow for the creation of custom post types directly in the WordPress back office.
- Easy Content Types
Easy Content Types provides an extremely easy to use and intuitive interface for creating custom post types, taxonomies, and meta boxes.
Create custom post types, taxonomies and custom fields with ease making WordPress a more robust CMS.
- OUR FAVOURITE: Custom Post Type UI
Great interface, ability to create taxonomies, good support community. Lacks custom field creation functionality; however, only free plugin to export to proper universal PHP code.
In an upcoming article, I will demonstrate how to use the Custom Post Type UI plugin and how to create your own widgets with your newly created Post Types. Stay tuned!