Custom post hierarchy

This is the path for custom post types that are used in the website, with single.php being the default template. Usually, custom post type designs differ considerably from the blog post designs, and hence the use of the dynamic single-$post_type.php template is almost guaranteed. We have to create a new template inside the root folder of the theme and name it with the slug post type. These templates are frequently used in premium themes and hence you can look for templates with the single- preference.

Apart from the main template, we also get the two preceding templates by using the slug of the post and using post templates, as we discussed in the previous section. The use of single-$post_type-$slug.php will not be essential ...

Get WordPress Development Quick Start Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.