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 created a portfolio page to show my works for my theme Everything is ok on my portfolio page, but when I click on an link to go to the portfolio object page, it uses the template's single.php page.

I would like it to use the template page I created "single-portfolio.php". How do I do this?

share|improve this question
A portfolio page, is that a post in a custom post type? – Mike Madern Jan 17 '13 at 15:16
up vote 1 down vote accepted

You have to use the Slug of your Custom Post Type "portfolio" for the filename, as you pointed out, single-portfolio.php is correct if your slug is "portfolio".

You just have to take one more step, create the file in the Theme directory (the same folder where your single.php is located).

WordPress automatically selects the single-portfolio.php for the Portfolio CPT if the file is there, and if it is not there, it takes the single.php.

share|improve this answer
thanks so much for all – Chead Jan 17 '13 at 21:11

The WordPress codex page Template Hierarchy should give you some insight about WordPress theme files naming conventions and how WordPress chooses a certain file and not another:

Graphic Example of the WordPress Template Hierarchy Structure

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.