I’ve used custom post types to display portfolio items since WordPress 3.0 when they were first introduced.
Portfolios work well as a custom post types because they generally aren’t displayed in the regular feed (like posts), they usually need a taxonomy (which isn’t done in pages by default), and as a custom post type its easier to give them their own metaboxes (like a project link, or image).
However, if you register a “portfolio” post type directly with the theme- whenever you change themes you’ll need to copy over the code code. And since I just recently did this, I thought I might as well release my code as a plugin and let other folks do it as well.
What This Plugin Does
The Portfolio Post Type Plugin will:
- Registers a new portfolio post type
- Registers separate portfolio taxonomies for tags and categories
- Displays the portfolio image in the dashboard column view
What This Plugin Doesn’t Do
This plugin won’t handle any of the front end display of your post type. If you want to style those or change the layout, you’ll probably want to add archive-portfolio.php and single-portfolio.php to your theme.
When You Shouldn’t Use This Plugin
If you want your portfolio items to go out in the regular feed, or be displayed alongside posts- you’ll likely want to use post formats instead. With a post format you can set your post as an “image” or a “gallery”, and even display it differently on the front end using custom templates. Here’s a link to the codex about post formats.
How Does the Code Work?
I wrote a full explanation of the plugin code over here.
Hi Devin,
I’d like to use your Portfolio Post Type plugin. So I followed you instruction-video.
After installing and activating the Plugin, option “Portfolio” is not shown in the left bar of the Dashboard.
Can you please tell me why?
Many thanks in advance.
Gr. Jeroen
Not sure. Try using the default theme (Twenty Eleven) and disabling all plugins except for the Portfolio Post Type. Does it work then?
Hi Devin,
Thanks for your fast reply.
I already got the idea last night, and it works!
I swithced to the default theme and removed all plugins.
Then I installed your Theme again and your Portfolio Post Type plugin and now, the option “Portfolio” appereas in the left column of the dashboard.
Thanks!
Regards,
Jeroen
Hi Devin,
Question about version compatibility: I recently installed WordPress 3.3.1 and Portfolio-Press 1.0. Right away I got a message to update the Portfolio Post Type Plugin. Yet when I click “install now” I get a warning that says “plugin has not been tested with your current version of WordPress” and a notice indicates that the plugin is compatible up to WordPress 3.2.1.
Does this mean I should not use the portfolio post type with WordPress 3.3.1 or is there a way to work around this dilemma?
Thanks in advance for any assistance.
Roberto
It works. I just haven’t needed to update the plugin in a bit so it doesn’t have the latest in there. I’ll update it when I have a minute.
Thanks for the info, I’ll give it a go.
Cheers
R.
Hi Devin, is there any way to use multiple portfolios on a website? We’re trying to use two different Portfolio galeries on our website, but after integrating a second page with the type of Portfolio all the “old” Portfolio items were displayed. Thanks for your help.
You can tag or categorize the portfolio items. When you view the tag/category pages it will only show items in that section.
OK, did that. Now I tried to add the link to the newly created category to my menu. But the menu section is greyed out, I can’t create any custom elements. My fault or doesn’t the theme have this capability?
Ah, forget it, stupid me. Didn’t get the concept of the menus at first. Not it works after adding a custom menu. Thanks anyway :).
Well … me again. I discovered another problem with this workflow. I’m using the Portfolio in a static page as a startpage for my website. Thus, the frontpage displays every Portfolio item available. Is there any way to filter this without using the direct link to the category?
hi thanks in advance can you plaease tell me how to add the portfolio to the page in my template display i dont have the portfolio template
That’ll need to be custom coded. You can look at how I did in it Portfolio Press though: https://github.com/devinsays/portfolio-press
how to display only certain categories in a page for example if i have 4 categories i want two categories in a page and other two in another page….
Thanks in advance
What would be the best way to have these posts show up in a /work page vs a /portfolio page?
You can create a page “work” and select the portfolio page template. Otherwise, you’d need to edit the plugin and change the archive slug.
Hi there, can you clarify what you mean by ‘edit the plugin and change the archive slug’? i need to display certain categories on certain pages. please help, and thank you!!
HI, I’m trying to set up 2 portfolio pages using your plugin. I have created two portfolio categories and assigned images to the various categories. When I add a new page and choose the portfolio template how do i choose the category to be shown, cant see an option to do this. Thanks in advance.
ger
There’s no option to do that. You would need to create a new page template that just displays the category you want.
Is there a way to order the portfolio items? Possibly manually setting the order?
Hey mate, I ended up using this: http://www.nsp-code.com/wordpress-plugins/post-types-order/
Hi Devin,
Just took a look at your updated WP Theming site. Looks like there is a plethera of information there!
Looking forward to getting a bit of tie to dive in.
How’s Austin treating you?
Michelle Samuel
You mean you haven’t been visiting to the site every single day?! All good here in Austin. Hot.
Hi!! I’m trying to add custom fields in the Portolio’s post and it doesn’t show in the public site. I add for example after .
Is there some restriction about that?
Thanks in advanced!!!
If your code is set up correctly to output them there should be no issue. There’s restrictions on custom fields.
Hey,
I’m looping through all the posts in my portfolio and I’m trying to add a class for each post. This class should be the post’s category, but I can’t seem to print out the post category.
Any ideas?
Thanks already :) Keep up the good work!
Hey,
After quite the while of experimenting I ended up using the following bit of code to print the post category in plain text.
echo strip_tags(get_the_term_list( $post->ID, 'portfolio_category'));
Quite simple when you look at it. Is there a better way?
Thanks again.
Yep, that’s the way to do with a custom taxonomy.
Typo on section What This Plugin Doesn’t Do
“font end display” instead of “front end display”
Sorry to be an ass ;) Great plugin, thanks :)
Thanks. Proof-reading help always appreciated.
Hi Devin,
there are a total of 7 portfolios in my design, i want to display only 2 selective portfolios for a particular page and the remaining 5 should not be visible. is there a way to do it
Cheers,
Shabari
You can look what I did in Portfolio Press to show 9 items per page: https://github.com/devinsays/portfolio-press
Could you tell me what you did to get 9 per page. As standard portfolio post types show 7 per page which is annoying as I have 8 portfolio items. 9 would be handy as I could always add another one in the future. This plug in is lacking a “settings” option to increase how many posts per page
The plugin just uses the options you have set under “Settings > Reading Options” unless you’re using a custom query.
In creating archive-portfolio.php and single-portfolio.php in the theme folder, is there more involved in getting them to work? Do I need to register these somewhere so WP knows to use them?
single-portfolio.php seems to work, but WP keeps using archive.php
Any tips?
There’s no trick to using archive-portfolio.php. It should just pull up if you have in the directory. You can see Portfolio Press to see how I’ve done it: https://github.com/devinsays/portfolio-press
Hi Devin,
Could you please elaborate on creating several separate portfolio sections? Ideally I would like several pages with separate portfolio galleries on each page. Ie. “Portfolio”, “current work”, “commissions”.
You also mentioned using a drop down menu to select pages. Is this something I would have to code into the theme? Or is the functionality already there?
Thanks,
Rebecca
Hi Rebecca. You can use tags or categories to create separate sections.
[…] plugin we will utilize is Devin Price’s Portfolio Post Type. Keep in mind their are other portfolio plugins out there. I picked this one because Devin is a […]
Great theme. Everything works fine so far. But I want to used blog editors such as “Scribefire” or “Windows Liver Writer”. Is there a way to get them showing the portfolio post type?
I’ve been using your plugin for almost a year, and it’s awesome.
How use Plugin Portfolio Post Type to add more than one image?
Must of projects hav emore then one unique picture.
How do this? don’t add images via normal post, its appear different size and border, like more to do that directly when add image when i make “add new portfolio”
How it displays out all depends on your theme. Did you mean to post this under the Portfolio Press post (https://wptheming.com/2010/07/portfolio-theme/)?
Will this plug in allow me to automatically pull blog posts into my portfolio?
If you already have a lot of posts, you can convert them to portfolio posts using the “Post Type Switcher” plugin.
Hello.
Thank you for the great plugin. This plugin is just what I was looking for.
I have only one question. I want to rename the portfolio to images or something else.. How can I do this and is it easy to do?
I’m not very good at php or things like that ( true blond LOL) but I was hoping you could help me
Thank in return !!
You’d have to edit the slug (‘rewrite’ => array(“slug” => “portfolio”), // Permalinks format). Change “portfolio” to “image”.
If you do alter the plugin, make sure to change the name of the plugin or bump up the version number really high so it doesn’t get overwritten when an update comes out.
Thank you so much !! I was almost pulling my hair out for not finding the solution. I’m a reall php noob and never guessed it was so simple.
doing happy dance now :)
Hi Devin,
I may a well tell you this is my first time using word press and your responsive temple is exactly what I was looking for but Im having trouble I followed your vid but I wasn’t getting the tab image first and couldn’t find a way back to the image or put them together into a portfolio page.
I was wondering was there an issue with the plug in because the portfolio icon is gone (all blurred ) and the one time I got the tabs up the black colour that comes over the tab image was blinking like rave lights.
Thanks,
Lorcan
Um, nothing should be blinking. Are you sure you didn’t try to set up the site after attending a rave? :)
I’d try disabling all your other plugins, and see if that solves the issue. Then you can add them back one by one and see which might be causing the problem.
Hi Devin,
I’d like to use your extension, but I don’t know how to display the portfolio in my website, in the twenty twelve theme; what do I have to write ? I also don’t know how to add a Thumbnail.
Thanks,
Vianney
You might be better off using a theme that already has support for portfolio post types if you’re not familiar with coding. This plugin can be used with Portfolio Press: https://github.com/devinsays/portfolio-press
Hi Devin, I would like to ask you. Is it possible to remove or hide the “Posted on” by ? I tried to look for it and google it without any luck. I also using your Portfolio Press theme. Is it somewhere at the loop.php or CSS style ?
Hey, Devin. Found your blog a few years ago and come back now and again, using it as a reference for WP coding related subjects. Thanks for all the knowledge.
A theme I am developing has an integrated custom post type called albums which utilizes a few custom templates (archive-albums.php, content-albums.php, etc.). What I want to do is transfer this functionality, along with the template files, into a plugin for the sake of portability. I easily transferred the CPT code but when I try to pull the template files over, things fall apart. Did a search and read a few (otherwise) informative blogs, then I thought of your portfolio post type plugin and thought I could figure it out by picking it apart. I see you instruct people to create custom templates and put them in the theme directory.
Here’s the question: Can custom template files be stored within the plugin folder or must they be in the theme folder? I feel like it should be simple to somehow register the templates so WordPress knows to load them. Thanks in advance!
Hi Sean. Custom post types will use single.php and archive.php if the specific post type templates aren’t available- so themes that don’t support your plugin still have a fallback. Since themes are so different, I think it’s difficult to make a generic template to load from your plugin that would still work and look good in all cases. The only plugin I know of that even attempts this is bbPress (http://wordpress.org/extend/plugins/bbpress/).
I am one of what looks like a number of people who want to use archive-portfolio.php and single-portfolio.php in the template I am already using, but am having trouble figuring out exactly what code I need in the function.php to make the two work. I am a beginner with php, but am not afraid to get into the code if I can get some instructions. I copied lines 222-245 of your code in the function.php on portfolio-press, but my pages are now just blank. I am sure I am missing a lot.
Thank you for your help!
Your theme should work with just the plugin installed. If you want to customize the appearance of your portfolio archive or single archive, just copy your theme’s single.php and rename it single-portfolio.php, then copy your archive.php and rename it archive-portfolio.php. Then you can customize as needed. No need to add anything to functions.php.
Hi Devin,
I’m using your plugin for a completely different purpose to what I’m guessing it was designed for. My question though is can I remove the /portfolio_category/ slug?.
If you see below, It looks odd when trying to list what I’m listing.
http://torrentbunker.com/portfolio_category/the-pirate-bay-proxies/
I’d want to ideally remove it or change it to a /proxy/ slug.
Cheers!
You can change the slugs by editing the plugin. Make sure also change the name of the plugin though so you won’t get your modifications overwritten if there is an update.
Is there a way to use shortcodes to list out a single category in a page or post?
Why wouldn’t you use the taxonomy archive for that?
Probably because I’m not all that experienced in programming, and I don’t know how. I’m guessing I’ll have to learn it now :)
Could you add a body class to custom post types with the category(s) and/or the tag(s)? And/or the parent or ancestor categories? I need this to style the parent menu links in the menu.
My menu is like this: Portfolio > Paintings > Boats > Boat 1.
Or can the parent and ancestor categories in the menu get the class “current-page-parent” or “current-page-ancestor”?
I hope you can help me.
I created an issue on GitHub for this. It also has a link for how to custom code it: https://github.com/devinsays/portfolio-post-type/issues/11
Dear Devin!
I want to create a page with my porfolio & They will paging in this page. This plugin can help me do this ? How must I do?
Thank you!
Yes. Activate the plugin, add items. Your theme should be able to handle portfolio posts fine, but you may want to style them further.
Hi Devin
I hope you can help me, I need to have a portfolio for my site but I need separate information on it for “designer” and “model”, an example “models” need to add body dimension’s but I don’t need that information displayed for “designer”. My thinking is styling the categories accordingly so the “models” display off one template and the designers display off another. I have attempted to change this via the single.php file so that it looks at category(‘1’) but nothing displays. The current code inside my single.php is
“
I have downloaded your plugin but will have to strip the current built in taxonomy for portfolio out, I don’t mind doing that but I for see a similar problem using your plugin. Please any help would be appreciated, as I have been turned away by wordpress.org and otw for assistance so far.
Thanks
Do you know how the template hierarchy works in WordPress? http://codex.wordpress.org/Template_Hierarchy
It should be fairly easy to add a specific named template file for each of your taxonomy slugs.
Dear Devin,
I need your HELP please. sorry for the caps. But I am in real need of your help.
I have been working with custom post types for lots of days. Recently I saw your plugin and a free theme. It is a wonderful job and contribution to the WP community.
ok, here is my question. I see that your theme uses archive-portfolio.php .
The great thing in it is, this file is used for both taxonomy and custom post type archive.
But when i create my own custom post type and taxonomy the archive-{custom post type}.php does not work at all.
Yes, I resave permalinks, also set “has_archive” , but yet archive-custom.php not at all working. I mean when i go to custom taxonomy page, it loads index.php file only.
Kindly reply what i am missing. I am working on it for more than a day to fix it. Though I am not a programmer, I want to achieve it.
Thanks for your help Devin,
The archive should definitely work if the post type is registered. Make sure your template is named correctly, etc. The custom taxonomy will not use that post type archive by default. In Portfolio Press, I use a little trick to do that. See portfoliopress_template_chooser in https://github.com/devinsays/portfolio-press/blob/master/functions.php.
Hi,
Thank you so much. Yes, I found it in functions.php
Hey Devin, I love your work.
I’m struggling with the thought process on displaying custom post types in a portfolio plugin shortcode while maintaining pagination, single post type pages and such without resorting to a custom page template, any tutorials/plugin examples you approve of? ( Otherwise, I’d need to bundle page templates with my plugin which isn’t ideal )
Custom post types will use single.php and archive.php of the theme by default. If you want to have a theme styled to display the custom post type special, I think that is theme territory.
Just got the widget area to work by referencing is_tax(‘portfolio_category’) instead of is_tax(‘portfolio-category’) whoops! Still having trouble with calling the active page portfolio category name… I’m using this:
But it’s not working… any suggestions?
Hi,
Thank you for a useful plugin.
One problem, however, is that the filter and search functions in the admin area don’t seem to work. They both always return “No portfolio items found” even though they clearly should find some.
Any thoughts?
Thanks for letting me know. I created an issue for the plugin and will look into it: https://github.com/devinsays/portfolio-post-type/issues/22
I found the solution.
In the plugin code, in the add_taxonomy_filters() function, replace:
echo ” . esc_html( $tax_name ) .”;
with
echo ” . esc_html( $tax_name ) .”;
That’s it!
I meant: echo ” . esc_html( $tax_name ) .”;
So just add value=’0′ to the very first option element of the dropdown menu.
Hi Devin,
I want to include embedded Google map APIs as portfolio items. Have you ever had that request before?
Is there a way to set that as a post type? Sorry I can’t be more specific. There seem to be a lot of variables to factor in.
You mean, embed a Google map in a post? There’s a number of plugins that would allow you to do that.
Just wanted to add a little note. I was trying to get archive_portfolio.php to work for my portfolio archive, but it just kept using archive.php. I found out that I had to use taxonomy-portfolio_category.php for it to work, but that was never mentioned in your plugin description so it took me some time to figure that out even though it’s a great plugin.
[…] plugins at this point, but one of them is essential to the structure of this site: Devin Price’s Portfolio Post Type. All about his implementation is well explained in this article by Justin Twerdy. Also, I used a […]
To: Devin
I use your Portfolio Post Type plugin and I appreciate of it coz it really helps me.
But I got a problem of how could I get all the list of my category (say its 10 categories). I use WordPress Foundation V2.0 as my theme in wordpress. I tried what is been suggest from this SITE but doesnt work well for me. Hope you could help me.
Their suggestions are exactly right. You can also look at the Portfolio Press code to see how it is done: https://github.com/devinsays/portfolio-press
Hey Devin,
Your plugin is pretty sweet! However, is there anyway to make the portfolio detail page full width? I want to drop the right hand column completely.
Thanks,
Roddy
I assume you’re talking about Portfolio Press? Yes, that feature is coming.
Hi, After updating WordPress to 3.8 I got a blank screen instead of my site.
In the code I see the that the body tag with its background image (through css) is loaded but this body is empty. After some testing I concluded that the error was within your plugin, which I updated to te latest version (0.7.0). After re-installing the previous version (0.6.1) the site and portfolio worked as expected.
We have a fix out for that (version 0.8). You can safely update now. Sorry about the issue.
Hi Devin,
Thanks for the awesome plugin, I came pretty close to what I want to achieve. But I cant figure out one thing:
Is it possible to display portfolio items from a specific category, on a static page? Could you point me in the right direction please?
Thanks
This is what I have so far: (on a static page): http://www.nanterre.nl/bouwbedrijf/schilder/schilderen-projecten/
And this is what I want to display (on a static page): http://www.nanterre.nl/portfolio_category/schilderen/
Hi Rick. You can query for terms in a custom taxonomy and display them where you choose:
http://codex.wordpress.org/Class_Reference/WP_Query
thanks a lot for your quick response Devin! I came across the article you mentioned, however, when I try to exclude categories from the portfolio template it doesnt work.. (e.g. cat=-31)
You can check out the code that i’m working with her:
https://wordpress.org/support/topic/portfolio-template-get-category
I know it has to do something with the “have_posts() ) : $wpex_port_query->the_post(); ?>” line, but I dont know how to do it. So frustrating. Can you please help me with this Devin?
Kind regards,
Rick
I got it to work! yes! thank you Devin
Hi!
I love your plugin, it’s so simple that it’s beautiful.
I’d like to suggest you if you can add:
'with_front' => false,
In the slug rewrte. This way, when we have a permalink structure for posts, it won’t affect the portfolio pages -which we use to want-.
Thanks!
I think we’re going to leave that true as the default as I think most people would want “portfolio” pre-pended. However, there is a filter for those $args and you could override it from your theme if you like.
Is there a way to change the slug to read collections/ instead of portfolio/?
Thanks
The “rewrite” in portfolioposttype_args. See: https://github.com/devinsays/portfolio-post-type/blob/develop/includes/class-portfolio-post-type-registrations.php
I have read the above comments but am still confused about how to separate portfolio items into different portfolios, “Artists” and “Sponsors,” for example. Is it just a matter of adding tags and categories into each portfolio item and they will filter themselves into the appropriate portfolio collection or is there a step I am missing?
Hi Mark. That is one way to do it. All your items will show up in the general “portfolio” archive, but only the items that are tagged or categorized will show up in that specific section. I’ve also written about templates to display portfolio categories: https://wptheming.com/2012/08/display-the-most-recent-post-in-each-category/
Hey guys,
I bought a theme about 2 years called “Stoodio” that had this plugin built in. The theme was taken off of theme forest and now I’m having some issues. The problem that I’m currently having is that I’m using portfolio to display a bunch of thumbnails and each one redirects you to a page with a video. I have 4 videos in each row and only 3 rows are viewable unless you click an arrow that SHOULD scroll over to the next set of images, but it doesn’t. The link changes and says that its showing page 2 but the thumbnails don’t change. Any ideas?
This plugin doesn’t control the display of portfolio items. I’d post your question in the WordPress Support Forums along with the URL to page you’re having issues with: http://wordpress.org/support/