Home › Forums › Add-ons › Gallery Field › Gallery field – echo a custom taxonomy as a class in the image container › Reply To: Gallery field – echo a custom taxonomy as a class in the image container
Q1:
An image is really a post type “attachment” as I’m sure you know. The ID in the $image is thus the attachments ID. So you should be able to fetch the term like:
//will return an array of term objects.
$terms = wp_get_object_terms($image['ID'], 'image_gallery');
Q2:
ACF uses the same image modals as WordPress core so this is really not an ACF thing. You’ve registered your custom taxonomy and now you need to add it to the modal. I don’t have any code for this but I’m sure you can find some by googling 🙂
There’s also plugins out there and this is one of the most tested: https://wordpress.org/plugins/enhanced-media-library/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.