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