WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a page "Portfolio", it contains a loop that outputs the list of portfolio (Custom Post Type, is this the problem?) items using page-portfolio.php. Problem is somehow WordPress used the archive.php to render my portfolio page, why is that?

share|improve this question
up vote 3 down vote accepted

An archive of a custom post type is displayed using archive-[posttype].php or archive.php if the first does not exist (see the Template Hierarchy for the full details). page-[posttype].php is only used if you create a "dummy" page to show a custom post type archive (before WordPress 3.1).

So in your case you should rename page-portfolio.php to archive-portfolio.php, and don't include a header to indicate a page template name.

share|improve this answer

I don't think it is possible to use portfolio.php for the Custom Post Type "Portfolio".

The way I have solved it on a site I did recently was to call my Custom Post Type "Project" instead. Then pull the content in via a Page Template called portfolio.php (see Brady's answer). Then to show the single Projects, I use a template called single-project.php

share|improve this answer
Was this before custom post type archives were introduced in WordPress 3.1? – Jan Fabry Apr 18 '11 at 11:35
Well Jan, I am not really sure as I have it working this way on 3.0, 3.1 and 3.1.1 – Piet Apr 18 '11 at 16:07

Make sure you have added the comment block to your page-portfolio.php to tell its a template.

Add this to the top of the file:

Template Name: A Template Name of Your Choice

Go into pages in the admin area of WordPress and create a page and assign the above template to that page.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.