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.

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

Leave a Reply

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>