Hello! Thanks in advance for any help.
I have two nested groups I’m trying to iterate over. This is supposed to be a grid of logos, each with a link to the company website. I’m loading my images as image arrays, and loading the alt text for each logo is essential for this project. I keep getting
Warning: illegal string offset 'alt'
Here’s my code:
<?php $partners = get_field('partners_logos'); ?>
<?php $sites = get_field('partners_links'); ?>
<?php foreach(array_combine($partners, $sites) as $logo => $site) {
if (!empty($logo)): ?>
<?php if ( $site ): ?>
<a href="<?php echo esc_url( $site ); ?>">
<img src="<?php echo esc_url($logo['url']); ?>" alt="<?php echo esc_url($logo['alt']); ?>" />
</a>
<?php endif; ?>
<?php endif;
} ?>
Unfortunately it’s still giving me the same error, just now iterated four times for my four logos.