【发布时间】:2021-03-18 18:17:12
【问题描述】:
我是 Twig 和 Timber 世界的新手,我刚刚开始了一份新工作,我很难掌握如何使用它。 我已经在 Twig 中提供了一个完整的设计,我已经将它转换为一个 wordpress 站点,我现在正试图通过 ACF 使其可编辑。在我的 front-page.php 中,我设置了以下内容:
$context['data'] = get_fields();
然后在我提供的设计的主页(树枝文件)中,这是一段代码:
{% include [
'override/pullquote.twig',
'components/pullquote.twig'
] with {
'title': data.my_story_title,
'section_class': 'light pullquote-standalone text-center',
'image': data.my_story_image,
'blockquote': data.my_story_quote,
'cite': '',
'link_footer': "Read Ramon's story",
'link_path': '#',
} %}
所以我为 title 和 blockquote 创建了 ACF 选项,并使用 data.my_story_title 和 data.my_story_quote 这些工作正常。但是,data.my_story_image 没有,它什么也不做。我哪里错了?大概我必须用它和图像来扩展它,但我不确定如何。这可能是一件简单的事情 - 任何帮助将不胜感激。
谢谢你:)
【问题讨论】:
标签: wordpress twig wordpress-theming timber