• Resolved redpupmedia

    (@redpupmedia)


    Hello.
    Love this plugin!

    In a custom theme build with Timber, we’re only getting the ID of the attachment as part of the Timber Post data. All options on the field (array, url, id) we tested and each setting only gives the id.

    {{ post.photo }} -> ID
    {{ post.get_field(‘photo’) -> Array | URL | ID (as set in field options)

    This might be an edge case for the plugin, and the get_field option might be the best option, but wanted to share the observation.

    Thanks for your work!

Viewing 1 replies (of 1 total)
  • Plugin Author joppuyo

    (@joppuyo)

    Hey!

    Glad you like the plugin, nice to see a fellow Timber fan ??

    This is actually how ACF works, images are stored in the meta field as an id which is the reference to the attachment. If you access the field directly, it will pull the id from the database without doing any modification.

    If you use get_field function in PHP or twig, it will pass it through the ACF filter that transforms the id to an array or URL.

    It works just like this in the normal ACF image field which is what this plugin is based on.

    It seems like get_field has actually been deprecated from latest Timber so guess post.meta(‘my_image’) should be used instead.

Viewing 1 replies (of 1 total)
  • The topic ‘Timber Post only getting attachment ID’ is closed to new replies.