6

I would like to be able to use the 'featured image' functionality, found on post types, for a custom taxonomy.

I have a taxonomy called 'collections' and I would like each collection to have a featured image. I will then use the featured image in a custom template that will show all of the collection, their titles and featured images.

I need the uploaded image to be resized into the custom image sizes that I have set in my theme.

There is a similar question here: Can I set a default featured image for a category? However, the top answer won't work for me, and I can't rely on a plugin.

Can anyone help?

Many thanks,

Keith

6

It's a little complex, but you can add custom meta to taxonomies. http://pippinsplugins.com/adding-custom-meta-fields-to-taxonomies/

You could pretty easily integrate a WP media uploader field that would allow you to enter an image into the field.

  • why pass 2 parameters 'add_action( 'edited_category', 'save_taxonomy_custom_meta', 10, 2 );' when the function only has 1 argument? Thanks. – csi Jun 27 '12 at 18:48
  • The function accepts two parameters, but two don't have to be passed. – Pippin Jun 27 '12 at 19:44
  • Why not leave it is add_action('edited_category', 'save_taxonomy_custom_meta'); instead? I have seen this in a few examples where the function only accepts one parameter but the add_action declares 2. Just wondering why this would be. Thanks. – csi Jun 28 '12 at 15:33
  • If the function can have 2 parameters, then the 2 should be set in the add_action, but it does not have to be set in the call back function. – Pippin Jun 28 '12 at 17:44

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.