Custom Post Type Archive

The use of custom post types is common in modern WordPress sites. Unlike a normal blog post, custom post types can contain a considerable amount of data and design requirements. Therefore, it may not be feasible to use archive.php to load the list of custom posts in most scenarios.

Instead, we can observe the preceding diagram to identify the use of additional template files. Unlike the previous paths, we only have one dynamic template for custom post archives, called archive-$post_type.php. The post type variable should be replaced by post types in your sites such as product, topic, and forum. Even though this is a dynamic template type, we can create and add this template to child themes, since custom post types ...

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.