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.

149 Responses

  1. I am using Portfolio Post Type with the Portfolio Press theme since there are ready-made templates. The portfolios are being used to feature artists, artisans and musicians for our upcoming Summer art show. We are also featuring our show sponsors in the portfolio section. The problem is that when using the navigation arrows inside the “single-portfolio.php” template, there is no separation between the artists and sponsors. I would prefer to have them in separate sections.

    If I were to duplicate the plugin folder to create a “Sponsor” custom post type, which files would I need to modify? I assume most of the heavy listing is done by “portfolio-post-type.php” but there are other files inside the “includes” folder. Obviously I would need to create content-sponsor, single-sponsor and archive sponsor templates. I am working inside a child theme so there is no danger of the files being overwritten.

    Thanks.

  2. David

    Hi, I just did a bunch of updates last night and now the portfolio items don’t show up on the home page (as they used to). There is just one light grey box with a picture symbol (mountains and sun) in it where before it displayed my 9 portfolio items. How can I get this working again? Many thanks in advance!

  3. I’m not sure what happened, but my portfolio press portfolio tag and categories navigation is suddenly missing. I can’t alter or add anything to the wp nav menus. I wonder if it was something that got lost in updates? Any help or advice you or anyone reading might provide would be awesome.

  4. I´m building a site with the story template and the portfolio plugin. Im using the qTranslate X to have the site in Norwegian (main) and in English. Almost everything seems to work fine except the Portfolio gallery page. Once you open a product [:NO]NORGRIP SKLISIKRING[:EN]NORGRIP ANTI-SLIP[:] this this comes up. If I do press reload page it disappears and works perfectly. Could you please help me?

    web page name is http://www.glassfiber.no

    Thank you so much

  5. Markus

    Hi!

    thank You for this perfekt working plugin!
    I want to chance the word ‘portfolio’ in the browser path.
    Is this possible? Do You have any idea?

      1. Rani

        Thanks for the plugin.
        How do I apply your answer?
        I’ve tried this:

        apply_filters( 'portfolioposttype_category_args', array('rewrite'=> array( 'slug' => '' )));

        Didn’t work.
        Thanks
        Rani

  6. Jordan Johansen

    Hello Devin,

    Thank you for the awesome plugin, and Portfolio Press theme. I’ve been tweaking your theme to fit my purposes, and I’m hoping you can point me in the right direction. Right now I’ve got a static home page that is using a modified version of your full-width-portfolio template to display four image thumbnails that link to different portfolio_category pages. There’s a carousel I’d like to use that only works with image galleries, so I’m trying to figure out how to get the full-width-image-gallery-formats template to act similarly to those /portfolio_category/ pages.

    The simplest way I can think of (although not the most elegant) is to make different templates (based on your image-gallery template), in which I modify the WP_Query to return the appropriate items. To that end, can you tell me how I might access the portfolio post type category taxonomy in WP_Query?

    Thank you for your time.

    – Jordan

  7. Hi. I just installed your plug in because I wanted to assign different pages to different portfolio categories. I can’t seem to be able to assign a specific portfolio category to a certain page. My theme (scope) still only allows me to select a general portfolio and your plug in did not add further detail so that I can select the specific portfolio category I want displayed.

    Does the plug in not function this way?

  8. I’m so sorry I’m a bit of a newby at this. I’ve followed all the instructions and my portoflio page looks fantastic! I’d just like to make one change to the style which I know involves code, I’d like to have the images in full colour all the time without having to hover over them for them to be in full colour. Would you be able to help me at all?

  9. Janson

    Thank you for your plugin! Wonderful job!

    I have some problems and wishes:

    1. Icon of plugin parameters and options in screen options is missing
    2. I use Masonry Mode Gallery in Columned item type. But that all correctly displayed I have to choose Item type – “Side portfolio”, then I turn to the section “Side Portfolio” and check the checkbox – “Masonry Mode Gallery”. Then I must publish post, and then I choose “Columned” Item type and again publish post ;) Unfortunately the only right way to do Masonry Mode Gallery in Columned item type.
    Add please checkbox “Masonry Mode Gallery” for Columned item type
    3. Very slow scrolling in “portfolio gallery” section.

    also in new versions I would like to see the ability to bulk add photos.

      1. Hey. Elementor Pro Have released an update where you can create and edit Archive Pages + Heade + Footer and everything.
        I have managed to get a pretty good job with it and with your plugin.
        Yet the ONLY thing that is missing is changing the Title of the Portfolio page.
        I’ve searched on every option on this website and didn’t find how to change the (SEO) Title of the Portfolio page.
        because it looks terrible on Hebrew website breadcrumbs.
        its looks like this
        https://imgur.com/a/9cKTQLG

        It will be MASSIVE if you could create this pages and just save us all some time…
        thank you so much!

      2. Well, How can I add a translation to this plugin?
        I have WordPress.com User and still I can’t seem to find the “Add A Translation” button or something like that

      3. Well.
        I found.
        I just changed this file
        portfolio-post-type/includes/class-portfolio-post-type-post-type.php
        and the names of it.
        thanks!

  10. Anna

    Hi Davin,

    Thank you for the plugin. I am trying to figure out how to:

    1: Link more than one portfolios together. So if I press on a picture of a logo then I can end up at the portfolio of the whole project. Is that possible? I checked the “Parent Portfolio Page” in the portfolio item, but that didn’t seem to be it. Or I am doing it wrong.

    2: Block the possibility to go in and see the portfolio item when the featured image is in display on the website. To take away the plus. I know that is possible to take away that it is showing the plus on the featured image but still when I press it you get into the portfolio. Is it possible to take the link away?

    Cheers,
    Anna

  11. Hi, can you tell my why the gallery doesn’t show all the portfolio item i have please? It does when I click ALL categories. (Shown on cocktails page)
    Also, can I change the order of the categories displayed?
    One last thing, the gallery does not show any items on a mobile, unless you click one of the categories. Many thanks

  12. Matt

    I’m trying to add google analytics to the pages built using this portfolio plugin, but am seeing no where within the plugin to add the GA code. Is there a place I can add GA using the plugin or do I just need to install it within the overall theme?

  13. Guy Carnegie

    Hi Devin,
    I’m trying to use the portfolio post type to show portfolio pages for my camera club. The thing is we have around 70 entries per month, and as I need to show them in the masonry format, I need to add them to the “columned” style ONE AT A TIME! Is there no way for me to have a masonry style portfolio where I can select multiple items from uploaded media instead of one after the other?
    I have around a year and a half worth of portfolios to create, which is almost a thousand images.

  14. Lisa

    Hi Devin,
    sorry if my questions might sound silly. I googled a lot but still could not find any solution yet.

    How can I add categories slugs in my portfolio items?

    I would like my portfolio URLs to look like:
    http://www.mywebsite.com/portfolio/category/portfolio-item-1

    At present URLs are as follows:
    http://www.mywebsite.com/portfolio/portfolio-item-1

    Moreover, I would like to hide dates on my portfolio items page, but keep them on my articles page, but my WP theme seems to treat article and portfolio items the same way.

    Can you please help me?

      1. Hi Devin, I changed portfolio labels through pasting code from the github link you provided and my slug is successfuly changed, however, when I try to open one of the single posts withe the new slug I get 404 Error -> can you guess what might be the case here ?

  15. Towfiq I.

    Devin,

    Thanks for the plugin. I am here to report a serious issue. When you activate the plugin, the excerpt field for all post types in wp rest api is replaced with `… ` . Please kindly fix this issue. Thanks.

  16. Federico Mariani

    Hello Devin,
    I’have the 5.5 version of WordPress.
    I’ve installed the plugin and put the code into the Theme Functions.php
    I added the projects into first portfolio.
    Now how I can put the Portfolio on the Home page?
    Do I have to write something? [portfolio] doesn’t works
    In blocks options doesn’t appear any icon for insert the Portfolio post type.

    thank you in advance.
    Best.

  17. Hi, we’ve noticed that in the latest version of WordPress the Portfolio plugin is no longer being declared correctly, to allow duplicate post functionality to work.

    Could you possibly update the plugin so it’s compatible?

    Thanks

  18. I have a security plugin that is “concerned” that there’s no, recent updates. Does this plugin still work correctly as is, or should I remove it? And if I do, will it affect my story themed website?

Leave a Reply