Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm currently writing my first plugin, which will let the site admin/editor use a different image as a background/header for each post/page, and I would also like to have defaults for each category.

Here is where I'm not sure how to proceed: If for each post/page the image (which is an attachment, so is just an id in the db) is a simple post meta field, there is no such (implicit) thing for categories.

So there are more ways to go:

  • Create an option for every category - something like background_cat_$id_
  • Add the categories which correspond to a certain image to the attachment post ( corresponding_cats ? )
  • Modify the term_taxonomy table to add a column (last resort? bad design?)

Right now I believe I'll go with my first option but I'm really curios how you handle such issues.

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Best way would be to use this plugin:

http://wordpress.org/extend/plugins/simple-term-meta/

share|improve this answer
    
that seems to do everything I wanted to do. Is it any other way to mark it as a dependency other than writing in the README or using your dependency plugin? –  Cronco Jan 18 '11 at 18:39
    
Not that I know of. –  scribu Jan 18 '11 at 18:53
add comment

You can see the approach I use myself in my answer to this question

You're on the right track though. Until we have a taxonomy meta table then the options table is the tidiest solution. You could always create a taxonomy meta table yourself with the plugin though and make some get/set functions to go with it.

share|improve this answer
    
Your other answer seems really insightful and helps me with some other questions I had, but I'm still interested in some other points of view so I won't accept your answer quite yet :) –  Cronco Jan 17 '11 at 14:19
    
np. I'd be interested to see if anyone has implemented a taxonomy meta table myself. Seems like a worthy plugin to write. Hopefully my next project at work will cover the dev time. –  sanchothefat Jan 17 '11 at 14:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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