I have a client who has requested a WP based portfolio where they will present their projects and clients, filtered by categories and tags. They also wish to filter all projects done for a particular client. I decided to use regular posts for the projects, but I'm unsure as to what would be a good setup for clients.
My idea is to have a custom post type named clients, in which the user can create clients that are then made available in a custom field select list in each post. This would make for a robust structure but it seems a bit unnecessarily to have to use a custom post type simply to achieve this. Any ideas on a more effective approach?
2 Answers
It sounds like you need both clients and projects to have "post-like" capabilities, meaning that using a taxonomy for clients wouldn't make much sense. In this case, I would highly recommend the amazing "Posts 2 Posts" plugin by Scribu, found here: http://wordpress.org/extend/plugins/posts-to-posts/
The plugin allows you to create connections between posts, and makes it trivial to query posts based on these connections.
-
Thanks, this looks like a great plugin. If it weren't for the fact that I'm already using a couple of plugins I would choose this option as the solution. Need to keep the number of plugins down for now though. Commented Apr 6, 2013 at 10:37
A custom post type for "Projects" would probably be ideal and clients becomes one of the taxonomies for the CPT.
If you feel the CPT is overkill for the desired result, you can get away with using normal posts and custom fields instead of/in addition to categories and tags to provide an extra layer of filtering. Using custom fields is as simple as altering the loop:
$posts = get_posts('numberposts=10&meta_key=client&meta_value=StackExchange');
as you need to.
-
Thanks for your suggestion. Will keep that in mind before I make a decision, I would however like to simplify it as much as possible and keep the projects as posts if I can. Commented Apr 6, 2013 at 8:02