In WordPress theme you can set custom templates for custom post types ,A custom template used to display of single posts belonging to a custom post type .
suppose you have created a custom posts name books,
add_action( 'init', 'create_posttype' );
function create_posttype() {
register_post_type( 'books',
array(
'labels' => array(
'name' => __( 'Books' ),
'singular_name' => __( 'Book' )
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'books'),
)
);
}
to display single posts of a custom post type in our case 'books' we will use single-books.php
and their archives will use archive-books.php
0 Comment(s)