Ironically, Wordpress StackExchange has the perfect example of what I'm trying to do. At the foot of every page here is a key/legend of associated sites with a colour reference for each one. I need to create an identical looking key of my posts showing the project names and project colours for each project in my portfolio site. The project names and colour references are already in custom fields within my custom post type. However obviously a query will just return all the results.

I've been looking at GROUPBY but not been able to get it to work, anyone got a better idea or can tell me where I'm going wrong? Sigh, I can't seem to get an answer to this from Wordpress support or StackOverFlow, it can't be that difficult surely.

  • I've seen your question on the WordPress forums and Stack Overflow and I still can't work out exactly what you want to accomplish. it sounds as though 'color' should be a taxonomy rather than a custom field.
    – Milo
    May 13, 2011 at 16:25
  • Yes, sigh, that's what I ended up doing, a custom taxonomy instead which is then easy to list, I got everything working. I just came back here to update the thread. However I had to strip out my custom fields and replace them with custom taxonomies which was a pain and no-one explained how to show a color key for each taxonomy (as is done below on this site). Was the question unclear? I'm surprised to hear that. May 13, 2011 at 17:26
  • OK this site won't let me post the solution as I'm new so I'll post it over on StackOverflow where I posted the original question. May 13, 2011 at 18:18

1 Answer 1


This site simpley uses ■ and a span color for each link.

To query custom fields for your post type you should be using get_post_meta http://codex.wordpress.org/Function_Reference/get_post_meta

To customize the query, check out http://codex.wordpress.org/Function_Reference/WP_Query , you can include or exclude practically anything you want.

  • Well I have several custom queries working great so its a little more complex than a straight forward WP_Query. Please see my reply above. May 13, 2011 at 17:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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