-1

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?

1
  • 1
    A portfolio page, is that a post in a custom post type? Commented Jan 17, 2013 at 15:16

2 Answers 2

1

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.

0
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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