I need to show all my custom articles on an archive page but grouped/sorted by subject.

So that the result is somewhat like

Subject A:

  • A Sample Post
  • Another Sample Post

Subject B:

  • List item

A Post About Bacon

and so on?

I've read some related posts on here 17155 and 14306 and have come to the conclusion that this type of grouping must be done with post meta. However a simple metabox with a text input isn't as friendly as the checkboxes of the category metabox.... nor the tag box with its (choose from most popular tags option).

So I am looking for advice, what is the best way to get the best of both worlds? I'd like to enforce selection into only 1 subject, but I'd like to be able to see what other subjects have already been used.

Can I replace the category metabox so that it uses radio buttons instead of checkboxes and then save the category info as post meta on save? where to start?

  • Should the list be extendable by the user? You might need a datalist for this.
    – fuxia
    Jul 11 '12 at 15:52
  • i'd like the user to be able add a term. i think i am going to pursue this route: wp.tutsplus.com/tutorials/creative-coding/… am trying to wrap it into a full-fledged plugin at the moment. Jul 11 '12 at 19:20
  • i made a pretty good start on making that a plugin: github.com/helgatheviking/Radio-Buttons-for-Taxonomies i'm sure it needs some testing before i can add it to the repo. i like the idea of datalists though! more to learn i guess. Jul 11 '12 at 21:30
  • Would it not be preferable to add an additional taxonomy? And then add the taxonomy to the post type(s) Jul 15 '12 at 17:24
  • @BarryCarlyon - i ended up doing that. the trouble is you can't sort a query by taxonomy. Jul 16 '12 at 2:07

i ended up building a plugin that enforces radio buttons for any taxonomy.

for the project in question i will probably also save the taxonomy as meta. sucks that i need/want half the ability of taxonomy (knowing other available terms, etc), but need the sorting by meta.

  • The other option would be to create the taxonomy without a public UI and then build your own meta box for it. Jul 16 '12 at 10:42
  • the plugin removes the normal metabox and replaces it w/ my custom one. Jul 16 '12 at 19:34
  • Lovely. (I didn't follow the link to go look at the code :-P ) Jul 16 '12 at 21:36

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.