Problem with single-page for my custom post

Your code looks sound, so you should have a look at the code in your single.php template, as I suspect that there is something wrong in that template to why nothing is displayed. You should set debug to true in wp-config.php. This should help you locate your problem

Secondly, your single-posttype.php is wrongly named. Your post type is registered as “port”, and you are using “portfolio”. You should name your single page template the same as your registered post type. So you single template should be names single-port.php

Just for extra info, here is a small trick to force a template for use by a custom post type

function wpse_template_include( $original_template ) {
    if ( isset( $wp->query_vars['port'] ) && false == $wp->query_vars['port']  ) {
        return get_template_directory() . '/single-port.php';
    } else {
        return $original_template;
    }
}

add_filter( 'template_include', 'wpse_template_include' );

Leave a Comment