7

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

1
  • 2
    if you want to use a plugin here is the best one for it. wordpress.org/extend/plugins/taxonomy-images If you don't want to use any plugin you can checkout the plugin code to add codes to your theme.
    – Sisir
    Commented Dec 15, 2011 at 19:36

2 Answers 2

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.

4
  • why pass 2 parameters 'add_action( 'edited_category', 'save_taxonomy_custom_meta', 10, 2 );' when the function only has 1 argument? Thanks.
    – csi
    Commented Jun 27, 2012 at 18:48
  • The function accepts two parameters, but two don't have to be passed.
    – Pippin
    Commented Jun 27, 2012 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
    Commented Jun 28, 2012 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
    Commented Jun 28, 2012 at 17:44
1

With Advanced Custom Fields you can achieve this very easily:

https://www.advancedcustomfields.com/resources/adding-fields-taxonomy-term/

adding image to taxonomy in wordpress

addimg image to term in wordpress

Your Answer

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

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