I created a custom post 1, added ACF fields (image name and image to return image URL).
Then on the ACF fields groups of another custom post 2, I selected Post Object field to return ID then…. On the Add New post of the Custom Post 2, i get a drop-down (select field) of the ACF fields meant for custom Post 1.
On the public page, I used the exact code as above and I get the image correctly.
$iconImage = get_field('icon_image', $section['icon_selector']); --- <img src="<?php echo $iconImage; ?>" alt="<?php get_field('icon_name', $section['icon_selector']); ?>">
My challenge is the Drop Down/Select on the custom post 2 to select the image. It only shows the title of the record saved in custom post 1. How can I make this select field show image also?
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!
© 2022 Advanced Custom Fields.