Support

Account

Home Forums ACF PRO Location –> Attachment, how to display values ?

Solving

Location –> Attachment, how to display values ?

  • Tried this from documentation but cannot get it to work.

    Is it possible at all for ACF to detect all inserted or attached images to the post, and display theirs vaules previously added with ACF fields ?

    Second question, how to display multiple values if there are several images in post with ACF fields added to attachment.

  • Not sure I completely understand what you’re asking.

    Are you asking if ACF can find all the images that are attached to a post by WP or that have been added using an ACF image field? Or images that were added using an image field that removed from the field?

    Is the field group attached to the attachment or a the post?

    Can you explain in more detail?

  • – Asking how to display attachment metadata added with ACF fields.
    (say one attachment/image)

    – How to display list of attachment metadata values inside ACF fields
    (say multiple images in post, featured, inserted, gallery)

    I did it for now by borrowing some simple code from one plugin. But could not get it to work with ACF fields.

    – Yes, group is attached to the attachment, not to the post.

    More colorful example.

    – Few ACF fields for attchments, credits and licence of images.
    – Using Flickr images and dont want to deal with lawyers.

    Can you give some example of code how to display metadata for one image, and for several images, under content say.

  • If you are returning images from image fields as image opbjects then the basic meta data is included in that object. If you are returning IDs then you can use wp_get_attachment_metadata(). If you are returning the image URL then I don’t think it can be done.

    To get the content added to ACF fields attached to the attachment you would use

    get_field('field_name', $attachment_id)

    I don’t know if the $attachment ID is returned as part of an image object, you may need to return IDs to get them.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Location –> Attachment, how to display values ?’ is closed to new replies.