Home › Forums › General Issues › images as choices in select field › Reply To: images as choices in select field
Thank you for your help!
I was thinking of an if statement as well, but know that the selection field might grow to a lot of options, like 50+ easily. This means I will get a huge if statement, wouldn’t that be a problem?
Ah wait, I just found an option. If I name all my pictures “logo-brandname.jpeg” I can make a map in my /images folder with brand logos. then I can just upload the pictures to that map, e.g. “logo-coke.jpeg”, “logo-apple.jpeg”, “logo-sony.jpeg”
If I then make sure that the select field options match the brand name in the filename I can just use
<img src="/images/brand/logo-<?php the_field('reviewBrand'); ?>.jpeg"> right? that would be very convenient!
Thanks for helping me on this!
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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.