Custom post templates are a simple way to create custom layouts for individual posts. They are commonly used for things like About pages and Contact pages.
Setting a post to use a custom template in the post editor causes that post to take its layout cues from the associated template file, rather than from any file in the WordPress template hierarchy.
Registering a custom post template is very simple, using a Template Name: comment at the top of the PHP file. Custom templates behave just like files in the WordPress template hierarchy, including being able to use The Loop.
Custom post templates used to work only on posts of type Page. Since WordPress 4.7, however, it has been possible to create custom templates for any post type.
As we briefly covered in Core Concepts of WordPress Themes: 1. The Template Hierarchy, there are two ways to cause a webpage to inherit a specific PHP template:
Create a file inside the WordPress template hierarchy th...