Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media attachment meta output issue when used with ACF Pro Gallery !? #44

Open
timkoeck opened this issue Apr 12, 2016 · 3 comments
Open

Comments

@timkoeck
Copy link

Hi there,
firstly thank you very much for this awesome plugin. It generally works like a charme and makes working with acf custom fields and the REST API so comfortable!

I might have noticed an issue. Correct me if I am wrong ;)

I am using ACF Pro and added a gallery field:

1

In the next step I added media attachment meta fields that appear for every image uploaded to a gallery. Just for you to understand the intention: Those are two dropdown fields that can set the horizontal and vertical focus point position for an image that is used as a background cover on the frontend (responsive design).

2

So far so good... But here comes the issue: on the frontend side this information is only displayed once within the [acf][bg-showcase-images] node ('bg-showcase-images' is the gallery field-name as you can see on the first screenshot).

But as the meta value can be set individually for each image uploaded to an acf gallery field, I expected it to appear for each image entry of the gallery ([acf][bg-showcase-images][0], [bg-showcase-images][1], [bg-showcase-images][2], ...) which is sadly not the case. In the following screenshot you can see that the attachment meta values img_focus_x and img_focus_y are only once within [acf][bg-showcase-images] and that they don't appear for each image within the gallery:

3

Am I doing something wrong, missing something or is the script not working correctly for this special occasion?

Looking forward to read about your thoughts.

Cheers,
Tim

@timkoeck timkoeck changed the title Media attachment meta output incorrect for ACF gallery Media attachment meta output issue when used with ACF Pro Gallery !? Apr 12, 2016
@sheriffderek
Copy link

How did you go about adding the media attachment fields?

@timkoeck
Copy link
Author

I also used ACF. Just created a new field group and set file attachment as the rule for where to display.
You can take a look at the screenshot (sorry, it is german)...

screenshot 2016-04-13 02 12 29

@timkoeck
Copy link
Author

timkoeck commented Apr 15, 2016

Am I doing something wrong? I just implemented the same setup for another project where I am using php to fetch the data. This works as expected. I am fetching the gallery data firstly and in the next step I loop over the image entries. Each image entry has the two parameters.

    $images = get_field('bg_gallery');

    if ($images): ?>
        <div class="slides">
            <?php foreach( $images as $image ): ?>
                <?php $focus_x = get_field('bg_img_focus_x', $image['ID']); ?>
                <?php $focus_y = get_field('bg_img_focus_y', $image['ID']); ?>
                ....                        
                </div>
            <?php endforeach; ?>
        </div>
    <?php endif; ?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants