Portfolio Post Type

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.

99 thoughts on “Portfolio Post Type

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

    • Devin wrote:

      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.



  2. Roberto wrote:

    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.


    • Devin wrote:

      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.

      • Roberto wrote:

        Thanks for the info, I’ll give it a go.



  3. Ulf wrote:

    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.

    • Devin wrote:

      You can tag or categorize the portfolio items. When you view the tag/category pages it will only show items in that section.

      • Ulf wrote:

        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?

      • Ulf wrote:

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

  4. Ulf wrote:

    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?

  5. Saranya wrote:

    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

  6. Saranya wrote:

    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

  7. Jeff wrote:

    What would be the best way to have these posts show up in a /work page vs a /portfolio page?

    • Devin wrote:

      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.

      • emily wrote:

        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!!

  8. Ger wrote:

    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.


    • Devin wrote:

      There’s no option to do that. You would need to create a new page template that just displays the category you want.

  9. Jeff wrote:

    Is there a way to order the portfolio items? Possibly manually setting the order?

  10. Michelle S wrote:

    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

    • Devin wrote:

      You mean you haven’t been visiting to the site every single day?! All good here in Austin. Hot.

  11. Ana wrote:

    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!!!

    • Devin wrote:

      If your code is set up correctly to output them there should be no issue. There’s restrictions on custom fields.

  12. Christophe wrote:


    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!

  13. Christophe wrote:


    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.

    • Devin wrote:

      Yep, that’s the way to do with a custom taxonomy.

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

    • Devin wrote:

      Thanks. Proof-reading help always appreciated.

  15. shabari shankar wrote:

    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


  16. Paul wrote:

    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?

  17. Rebecca wrote:

    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?


    • Devin wrote:

      Hi Rebecca. You can use tags or categories to create separate sections.

  18. Pingback: Genesis Tweaks - Portfolio Custom Post Type

  19. Jing Xu wrote:

    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?

  20. Jon wrote:

    I’ve been using your plugin for almost a year, and it’s awesome.

  21. erre wrote:

    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”

  22. Lyndsay wrote:

    Will this plug in allow me to automatically pull blog posts into my portfolio?

    • Devin wrote:

      If you already have a lot of posts, you can convert them to portfolio posts using the “Post Type Switcher” plugin.

  23. Tandarts wrote:


    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 !!

    • Devin wrote:

      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.

      • Tandarts wrote:

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

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


    • Devin wrote:

      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.

  25. vianney wrote:

    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.


  26. Ariff wrote:

    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 ?

  27. Sean wrote:

    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!

    • Devin wrote:

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

  28. Ramune wrote:

    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!

    • Devin wrote:

      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.

  29. Luke wrote:

    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.


    I’d want to ideally remove it or change it to a /proxy/ slug.


    • Devin wrote:

      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.

  30. Kamilla wrote:

    Is there a way to use shortcodes to list out a single category in a page or post?

    • Devin wrote:

      Why wouldn’t you use the taxonomy archive for that?

      • Kamilla wrote:

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

  31. Winy Schalke wrote:

    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.

  32. Kim marketing wrote:

    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!

    • Devin wrote:

      Yes. Activate the plugin, add items. Your theme should be able to handle portfolio posts fine, but you may want to style them further.

  33. Jonathan wrote:

    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.

  34. Rajeshkannan MJ wrote:

    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,

      • Hi,

        Thank you so much. Yes, I found it in functions.php

  35. hhins wrote:

    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 )

    • Devin wrote:

      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.

  36. Galen wrote:

    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?

  37. philip ebels wrote:


    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?

      • philip ebels wrote:

        I found the solution.

        In the plugin code, in the add_taxonomy_filters() function, replace:

        echo ” . esc_html( $tax_name ) .”;


        echo ” . esc_html( $tax_name ) .”;

        That’s it!

  38. philip ebels wrote:

    I meant: echo ” . esc_html( $tax_name ) .”;

    So just add value=’0′ to the very first option element of the dropdown menu.

  39. Chris Holt wrote:

    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.

    • Devin wrote:

      You mean, embed a Google map in a post? There’s a number of plugins that would allow you to do that.

  40. Daniel wrote:

    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.

  41. Pingback: About this website | Aina Requena

  42. rcjr24 wrote:

    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.

  43. Roddy wrote:

    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.


    • Devin wrote:

      I assume you’re talking about Portfolio Press? Yes, that feature is coming.

  44. Winy wrote:

    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.

    • Devin wrote:

      We have a fix out for that (version 0.8). You can safely update now. Sorry about the issue.

  45. Rick wrote:

    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?


  46. Rick wrote:

    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:

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

      I got it to work! yes! thank you Devin

  47. Txema León wrote:


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


    • Devin wrote:

      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.

  48. Precious Baugh wrote:

    Is there a way to change the slug to read collections/ instead of portfolio/?

  49. Mark Hannon wrote:

    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?

  50. 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?

    • Devin wrote:

      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/

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>