微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用 Timber/Twig 从 ACF 选项页面图像中显示缩略图

如何解决如何使用 Timber/Twig 从 ACF 选项页面图像中显示缩略图

我正在开发自定义 wordpress 主题,但很难从 ACF(高级自定义字段)选项页面字段中获取缩略图图像显示在我的页面上,我在 wordpress 中使用木材/树枝,并尝试了多种方法没有成功:

{{options.tool_agreement.url }}{{options.tool_agreement('thumbnail') }}{{options.tool_agreement.thumbnail }} 以及 {{options.tool_agreement('thumbnail').url }} 这些都不适合我??

~感谢您的提示

以下是转储示例:{{dump(options.tool_agreement)}}

array (size=24)
  'ID' => int 254
  'id' => int 254
  'title' => string 'sample-agreement' (length=16)
  'filename' => string 'sample-agreement.jpg' (length=20)
  'filesize' => int 54741
  'url' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement.jpg' (length=78)
  'link' => string 'https://protoolsite.local/sample-agreement/' (length=48)
  'alt' => string '' (length=0)
  'author' => string '1' (length=1)
  'description' => string '' (length=0)
  'caption' => string '' (length=0)
  'name' => string 'sample-agreement' (length=16)
  'status' => string 'inherit' (length=7)
  'uploaded_to' => int 0
  'date' => string '2021-07-02 00:27:42' (length=19)
  'modified' => string '2021-07-02 00:27:42' (length=19)
  'menu_order' => int 0
  'mime_type' => string 'image/jpeg' (length=10)
  'type' => string 'image' (length=5)
  'subtype' => string 'jpeg' (length=4)
  'icon' => string 'https://protoolsite.local/wp-includes/images/media/default.png' (length=67)
  'width' => int 544
  'height' => int 703
  'sizes' => 
    array (size=18)
      'thumbnail' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement-150x150.jpg' (length=86)
      'thumbnail-width' => int 150
      'thumbnail-height' => int 150
      'medium' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement-232x300.jpg' (length=86)
      'medium-width' => int 232
      'medium-height' => int 300
      'medium_large' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement.jpg' (length=78)
      'medium_large-width' => int 544
      'medium_large-height' => int 703
      'large' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement.jpg' (length=78)
      'large-width' => int 544
      'large-height' => int 703
      '1536x1536' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement.jpg' (length=78)
      '1536x1536-width' => int 544
      '1536x1536-height' => int 703
      '2048x2048' => string 'https://protoolsite.local/wp-content/uploads/2021/07/sample-agreement.jpg' (length=78)
      '2048x2048-width' => int 544
      '2048x2048-height' => int 703

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。