Tutorial by Examples

To create a template for the single posts of our custom post type, we need to create a file called single-post_type_name.php where post_type_name is the name of our custom post type. For example, if our custom post type is called “Books”, we need to create a PHP file called single-book.php. Note th...
Custom Post Type Archive: To create an archive template for a custom post type you have to set the has_archive argument equal to true in your register_post_type() function. In the example below a custom post type is created for an Event post type. add_action( 'init', 'create_events_post_type' );...

Page 1 of 1