2

I wonder what's the right way of creating portfolio website (with as many portfolio pages I want). Usually I create page template that displays posts with category = Portfolio or with posts from Portfolio Custom Post Type. But what if I want multiple portfolios on my site? I know I can do it for example thru Theme Options page by assigning category to every portfolio page, but maybe there is a better way? Can I build mechanism like that:

  1. I add page and choose "Portfolio" template.
  2. After choosing template custom meta box appears. Inside custom box I have list of categories from my Portfolio Custom Post Type and I can choose which of the categories are displayed in this portfolio.

1 Answer 1

1

I think the best, most WordPress friendly solution is to use the default template hierarchy.

If you're using a custom post type and default categories, you first need to get the post type into the category (and tag) archive pages. This support thread does that.

Now, you can see the portfolio items at yoursite.com/category/web-design, where "category" is the base category slug set on Settings > Permalinks and "web-design" would be the slug of a category denoting a specific portfolio.

If you're using a custom taxonomy, you can control the slug better and have something like yoursite.com/portfolios/web-design. (Note that "portfolios" is plural. Make sure it doesn't overlap with an existing slug on your site.)

Finally, to customize the results, you use the template hierarchy. If you're using categories, then you can either edit all category pages with category.php (or create it based on archive.php) or create category-web-design.php (to edit a specific category template). If you're using a custom taxonomy, use the file taxonomy-portfolios.php for the whole custom taxonomy or taxonomy-portfolios-web-design.php for the specific term.

This is how WordPress is designed to be used, so I can't think of a better, more manageable way to handle this.

1
  • @smogg if this solved your problem, make sure to accept it as the answer. Otherwise, update your question and explain why this didn't work.
    – mrwweb
    May 8, 2012 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.