Home › Forums › Add-ons › Repeater Field › ACF get title from image › Reply To: ACF get title from image
You will need to set the return value of the image field to ‘object’, currently it looks set to ‘URL’.
Then you can do something like this:
<?php while ( have_posts() ) : the_post(); ?>
<?php if( get_field('projectafbeelding') ): ?>
<?php while( has_sub_field('projectafbeelding') ):
$image = get_sub_field('afbeelding');
?>
<li style="background-image: url('<?php echo $image['url'];?>');">
<?php echo $image['title'];?>
</li>
<?php endwhile; ?>
<?php endif; ?>
<?php endwhile; ?>
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.