• Resolved Marioline

    (@marioline)


    Hi,

    The plugin is working great in the admin, but now I’m finally ready to use the gallery in the frontend, I can’t get it to work.
    I’ve tried using the code example from your previous plugin, replacing
    $images = acf_photo_gallery(‘vacation_photos’, $post->ID);
    with
    $images = get_field(‘vacation_photos’, $post->ID);
    but am just getting a load of warnings, starting with
    Warning: Undefined array key “id”

    What am I missing?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Navneil Naicker

    (@navzme)

    Hi,

    Please change your code with the following:

    <?php
    $images = get_field('vacation_photos');
    foreach($images as $gallery){
    ?>
    <div style="display:inline-block;">
    <img src="<?php echo $gallery['metadata']['thumbnail']['file_url']; ?>" alt="Gallery Image"/>
    </div>
    <?php } ?>

    The above code should give you images that are thumbnail size. You can do something like:

    echo '<pre>';
    print_r($images);
    echo '</pre>';

    The above code will give all the information that you can use in your code.

    Thread Starter Marioline

    (@marioline)

    Yep, that works, thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.