1

I've got a repeater field with images;

<?php
$produkt = get_field('produkte-startseite');
<div class="row start-products">

<?php foreach ($produkt as $produkte): ?>
    <a href="<?php echo $produkte['url']; ?>">

        <div class="col3">
            <img src="<?php echo $produkte['bild']['sizes']['large']; ?>"
                 alt="<?php echo $produkte['alt']; ?>">

            <h3><?php echo $produkte['produkt-name']; ?></h3>
            <div class="overlay"></div>
        </div>

    </a>

And this is a little quote Code for var_dump of $produkte['bild']:

aint(1024) } } CROSSING array(24) { ["ID"]=> int(1764) ["id"]=> int(1764) ["title"]=> string(15) "crossing-starrt" ["filename"]=> string(19) "crossing-starrt.jpg" ["filesize"]=> int(200328) ["url"]=> string(74) "https://wwww.web.de/wp-content/uploads/2016/12/crossing-starrt.jpg" ["link"]=> string(50) "https://www.web.de/start/crossing-starrt/" ["alt"]=> string(5) "test1" ["author"]=> string(1) "1" ["description"]=> string(5) "test1" ["caption"]=> string(5) "test1" ["name"]=>

The problem is that I do not receive any alt text. But if I do var_dump it gives me as a result 4 arrays with 4 alt text. Could someone help me?

  • What does your var_dump look like? – Pim Oct 2 '18 at 8:42
  • I have made a small quote of the var_dump – Dario B. Oct 2 '18 at 11:42
0

You probably need $produkte['bild']['alt'] instead of $produkte['alt'].

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.