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

如何从 Twig/Timber 中的组的选项页面显示高级自定义字段 - WordPress

如何解决如何从 Twig/Timber 中的组的选项页面显示高级自定义字段 - WordPress

因此,如果我的“选项”页面上有一组名为 product_tools 的字段,以及 tool_link、tool_picture 和 tool_name 我正试图在带有树枝的页面显示它,但它对我不起作用? {{ options.product_tools.tool.name }} 当我进行转储时,我可以很好地获取数组中的所有字段。

这里是转储:{{ dump(options.product_tools) }}

C:\Users\WpDev\Local Sites\protoolsite\app\public\wp-content\plugins\timber-library\vendor\twig\twig\src\Extension\DebugExtension.PHP:70:
array (size=3)
  'tool_link' => string 'https://www.dewalt.com/products/power-tools' (length=43)
  'tool_picture' => 
    array (size=24)
      'ID' => int 307
      'id' => int 307
      'title' => string 'band-saw' (length=8)
      'filename' => string 'band-saw.jpg' (length=12)
      'filesize' => int 103647
      'url' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw.jpg' (length=69)
      'link' => string 'http://protoolsite.local/band-saw/' (length=39)
      'alt' => string '' (length=0)
      'author' => string '1' (length=1)
      'description' => string '' (length=0)
      'caption' => string '' (length=0)
      'name' => string 'band-saw' (length=8)
      'status' => string 'inherit' (length=7)
      'uploaded_to' => int 0
      'date' => string '2021-07-13 14:37:29' (length=19)
      'modified' => string '2021-07-13 14:37:29' (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 'http://protoolsite.local/wp-includes/images/media/default.png' (length=66)
      'width' => int 1000
      'height' => int 1000
      'sizes' => 
        array (size=18)
          'thumbnail' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw-150x150.jpg' (length=77)
          'thumbnail-width' => int 150
          'thumbnail-height' => int 150
          'medium' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw-300x300.jpg' (length=77)
          'medium-width' => int 300
          'medium-height' => int 300
          'medium_large' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw-768x768.jpg' (length=77)
          'medium_large-width' => int 768
          'medium_large-height' => int 768
          'large' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw.jpg' (length=69)
          'large-width' => int 1000
          'large-height' => int 1000
          '1536x1536' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw.jpg' (length=69)
          '1536x1536-width' => int 1000
          '1536x1536-height' => int 1000
          '2048x2048' => string 'http://protoolsite.local/wp-content/uploads/2021/07/band-saw.jpg' (length=69)
          '2048x2048-width' => int 1000
          '2048x2048-height' => int 1000
  'tool_name' => string 'Dewalt Bandsaw' (length=14)

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