0

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.

2 Answers 2

0

Best way would be to use this plugin:

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

2
  • 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, 2011 at 18:39
  • Not that I know of.
    – scribu
    Jan 18, 2011 at 18:53
1

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.

2
  • 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, 2011 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. Jan 17, 2011 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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