function create_posttype() {
register_post_type( 'CUSTOM__POST__TYPE',
// CPT Options
array(
'labels' => array(
'name' => __( 'CUSTOM POST TYPE NAME' ),
'singular_name' => __( 'CUSTOM__POST__TYPE' )
),
'public' => true,
'has_archive' => true,
//if you want the post type to be absent from
//site search
// 'exclude_from_search' => true,
'rewrite' => array('slug' => 'CUSTOM__POST__TYPE'),
)
);
//if you have rules set, you'll need to use this
//make sure you comment it back after running this once
//to improve performance
//flush_rewrite_rules();
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );
<?php include get_template_directory() . '/header.php'; ?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- insert content and markup here -->
<?php endwhile; ?>
<?php include get_template_directory() . '/footer.php'; ?>
<?php
/**
* Template Name: Single Custom Post Type Template
* Description: This is for a single entry of a custom post type.
*/
?>
<?php include get_template_directory() . '/header.php'; ?>
<?php while ( have_posts() ) : the_post(); ?>
<!-- insert content and markup here -->
<?php endwhile; ?>
<?php include get_template_directory() . '/footer.php'; ?>