ThemeForest

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

2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
DDStudios says

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? :)

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

1 year ago
554 posts You Reap What You Saw
  • Has been a member for 2-3 years
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Referred between 200 and 499 users
Bluz says

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

1 year ago
798 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 10 and 49 items
  • United States
fillerspace says

http://codex.wordpress.org/Post_Types 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.

1 year ago
2094 posts
  • Has been a member for 2-3 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Grew a moustache for the Envato Movember competition
  • Most Wanted Bounty Winner
  • Community Moderator
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • United States
  • Referred between 500 and 999 users
sevenspark says

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 :)

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

1 year ago
sevenspark is a moderator
2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
DDStudios says

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.

1 year ago
2942 posts
  • Has been a member for 3-4 years
  • Won a Competition
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Contributed a Blog Post
  • Author had a File in an Envato Bundle
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 100 000 and 250 000 dollars
  • Elite Author
  • Bought between 100 and 499 items
  • Australia
  • Referred between 200 and 499 users
DDStudios says

Oh! I’m stupid :)

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

Thanks a lot guys!

1 year ago
554 posts You Reap What You Saw
  • Has been a member for 2-3 years
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 50 000 and 100 000 dollars
  • Elite Author
  • Bought between 1 and 9 items
  • Referred between 200 and 499 users
Bluz says

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. :)

1 year ago
3086 posts
  • Has been a member for 3-4 years
  • Author had a File in an Envato Bundle
  • Interviewed on the Envato Notes blog
  • Author had a Free File of the Month
  • Beta Tester
  • Exclusive Author
  • Sold between 250 000 and 1 000 000 dollars
  • Elite Author
  • Bought between 10 and 49 items
  • Italy
  • Referred between 100 and 199 users
ParkerAndKent says

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”.

1 year ago
1374 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Bought between 10 and 49 items
  • Serbia
  • Referred between 10 and 49 users
1743 posts
  • Has been a member for 3-4 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Exclusive Author
  • Sold between 5 000 and 10 000 dollars
  • Bought between 10 and 49 items
  • Germany
  • Referred between 1 and 9 users
BroOf says

@WPwpCanyonThemes

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

1 year ago
by
by
by
by
by