Please see the Template Hierarchy. There is no template-portfolio.php
template. It needs to be archive-portfolio.php
.
Also, you should not be using a custom query*. Use the main query in your post type archive templates. WordPress already queries the correct posts for you.
So remove:
$portfolio = new WP_Query('post_type'=> 'portfolio');
And replace:
while ($portfolio-> have_posts() ) :
$portfolio->the_post(); ?>
With:
while ( have_posts() ) :
the_post(); ?>
Also, you’re not actually using content-portfolio.php
anywhere. You need to actually include it into the archive template. Somewhere between while ( have_posts() ) :
and endwhile;
:
get_template_part( 'path/to/content-portfolio' ); // Leave off the .php
*It seems like at least 50% of the questions posted here these days are caused by people incorrectly creating a new query when they should be using the main loop. I’d appreciate any insight into where people are learning to do this.