What is a Post Type (and custom post type) in WordPress and how do their templates work?
Different sections of content
Post types, including custom post types, are essentially sections of content on your website.
These could cover sections such as blog posts (post post type), web pages (page post type), products (product post type, brought in when installing WooCommerce) and shop orders (shop-order post type, again through WooCommerce).
As you can see from the post type examples above, each post type can have either very similar or completely different functionalities between them. However, each post type usually can share the functionality of creating singles within them.
Each post type can also be configured to allow different supports, such as taxonomies (which act as categories) or thumbnails (which act as featured images) for example.
Learn how to create a custom post type.
Configurable post type templates
Post types can use different theme templates between them. The more supports you use, the more templates you can override.
- single-{post-type}.php – available if singles are public.
- archive-{post-type}.php – available if archives are enabled.
- taxonomy-{post-type-taxonomy}.php – available if taxonomies have been set.
Tip: Remember to refresh your permalinks after creating the template files.