How to make a custom "single.php" page for custom posts?

Ok I have my portfolio custom post set up … and I created a custom template to show them so everything is ok for now.

But if I click on the post title, it lead to the single.php template … like my normal post do but I don’t want to … I want them to have their own single page …

How do I do that? :slight_smile:

Just for an exemple, on Classica : http://themes.premiumpixels.com/classica/portfolio/

If you click on the title of the portfolio post, it lead to a different page than blog post page.

Thanks!
Dany

I think you only need to create a file called “single-posttypename.php” and style it to your needs.

What is Post Type? – Documentation – WordPress.org has what you’re looking for

In the same way that posts are shown on their own page with single.php, custom post types will use single-{posttype}.php if it's available.

So for the above example, you could create a single-acme_product.php file and the product posts would be shown using that template.

I think you can just create a template named single-portfolio.php (assuming your custom post type is portfolio). See this for more info: http://codex.wordpress.org/Template_Hierarchy#Single_Post_display

Hope that helps :slight_smile:

EDIT: That was some amazing response time, guys :stuck_out_tongue:

Hey guys, I tried it already and it didnt seemed to worked. Will give it a second try and I’ll let you know if it worked.

Oh! I’m stupid :slight_smile:

I wrote single-portfolioposts.php instead of single-portfolio_posts.php :slight_smile:

Thanks a lot guys!

Great to hear Danny!
Related question, does this also work for the archives template?
For example “archive-portfolio_posts.php”?

EDIT: Sorry just checked in the codex and yes, it works the same way. :slight_smile:

Bluz said

Great to hear Danny!
Related question, does this also work for the archives template?
For example “archive-portfolio_posts.php”?

Yes, with wp 3.1

The bad thing is that there is no way to easily link to a custom archive from the wp menu… the only way is to create a link manually: site.com/?post_type=slug

This to use the built in custom archives, I’m not talking about “page templates that act like custom post archives”.

Source Digging Into WordPress blog

@WPwpCanyonThemes

Great found! Thank you! I really searched for something like this! tytytyty!

BroOf said

@WPwpCanyonThemes

Great found! Thank you! I really searched for something like this! tytytyty!

npnpnpnpnp. :slight_smile: