I am trying to create single page for custom post types but i can't really achieve it. Here is all that i am trying out -
snippet from functions.php for the registration of the custom post type
<?php
function custom_post_type() {
$labels = array(
'name' => _x( 'Tutorials', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Tutorial', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Tutorial', 'text_domain' ),
'parent_item_colon' => __( 'Parent Tutorial:', 'text_domain' ),
'all_items' => __( 'All Tutorials', 'text_domain' ),
'view_item' => __( 'View Tutorial', 'text_domain' ),
'add_new_item' => __( 'Add New Tutorial', 'text_domain' ),
'add_new' => __( 'New Tutorial', 'text_domain' ),
'edit_item' => __( 'Edit Tutorial', 'text_domain' ),
'update_item' => __( 'Update Tutorial', 'text_domain' ),
'search_items' => __( 'Search Tutorials', 'text_domain' ),
'not_found' => __( 'No Tutorials found', 'text_domain' ),
'not_found_in_trash' => __( 'No Tutorials found in Trash', 'text_domain' ),
);
$args = array(
'label' => __( 'Tutorial', 'text_domain' ),
'description' => __( 'Tutorial information pages', 'text_domain' ),
'labels' => $labels,
'supports' => array('title','editor','author','excerpt','custom-fields'),
'taxonomies' => array( 'category', 'post_tag' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_admin_bar' => true,
'menu_position' => 5,
'can_export' => true,
'has_archive' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'page',
);
register_post_type( 'Tutorial', $args );
}
add_action( 'init', 'custom_post_type' ); ?>
and i am using the template named single-Tutorial.php for this custom post type template. Also, in my posts display i am using the_permalink() to link to the post.
Now consider a post with title test3 now in my dashboard i see its permalink as -
http://localhost/deadman/portfolio/tutorial/test3/
and when i echo the contents of the_permalink i get -
http://localhost/deadman/portfolio/tutorial/test3/
Now though they are pointing at the same place but still i am being redirected to the homepage rather than the single post type page