问题描述
我尝试在 a related thread 上提出这个问题,但它在没有任何通知的情况下被删除了(我知道我没有提供解决方案,但提醒您删除我的帖子会有所帮助。 。我是新来的)。我在这里重试:
我以前从未使用过 Timber,并且拥有带有生成的短代码“[sp_easyaccordion id="352"]”的 Easy Accordion Pro 插件,并在我的 .twig 模板文件(位于 Themes>My Theme 中)中尝试了以下内容>templates) 并且所有呈现的都是纯文本 [sp_easyaccordion id="352"]。有什么想法吗?
{% function('do_shortcode','[sp_easyaccordion id="352"]') %}
或
{{ function('do_shortcode','[sp_easyaccordion id="352"]') }}
或
{% filter shortcodes %}
{{ wp.do_shortcode('[sp_easyaccordion id="352"]') }}
{% endfilter %}
或
{{ wp.do_shortcode('[sp_easyaccordion id="352"]') }}
简单地
{% filter shortcodes %} [sp_easyaccordion id="352"] {% endfilter %}
这些都没有用。另请注意,我没有在我的 function.PHP 文件中添加任何内容......这是我遗漏的东西吗?
解决方法
根据 documentation 应该是:
{% filter shortcodes %}
[sp_easyaccordion id="352"]
{% endfilter %}
否则你也应该能够调用这样的函数:
{{ function('do_shortcode','[sp_easyaccordion id="352"]') }}