It looks like your theme is missing certain key files that are needed in order to keep WordPress from defaulting to index.php
per the WordPress Template Hierarchy.
Since you have defined your portfolio
post type to act like posts by setting 'hierarchical'
to false
, you should probably be using the post custom template files.
In reading the chart from left to right, you want to create one, possible two files depending if you want the index view to be custom as well as the single post view. For the single view, WordPress uses single-$posttype.php
where $posttype
is replaced by the slug you gave your custom post type. In your case this file would be single-portfolio.php
. The archive page is a similar naming convention with archive-$posttype.php
so you would make archive-portfolio.php
Pages do not have support for this. With a page you can pretty much only use page-$id.php
or page-$slug.php
.