A code snippet for newbies
-
If you’re here because you have no idea how to
a) Query a custom taxonomy
b) Create a foreach loop with that taxonomy
c) Get the image object
d) Grab the source of that object
e) Create an array of backup images in case no image exists
f) Display the image (or placeholder) along with taxonomy dataThat’s because there really isn’t any documentation for this plugin. That’s a shame, since it’s actually a really nice piece of code.
I don’t have time to write a full tutorial, but I commented up my function that grabs either the entire term list of employees (people taxonomy), or just the ones linked to the page/post, depending on what is passed by reference – then displays the list with its corresponding image.
This is pretty hands-on stuff but if you’re completely list, it should point you in the right direction:
If you’re not using ACF, this plugin costs less overhead. If you are, already using ACF, you might find the documentation a bit more user friendly.
https://www.ads-software.com/plugins/s8-simple-taxonomy-images/
- The topic ‘A code snippet for newbies’ is closed to new replies.