Php 以木材(WordPress)作为特定页面模板的目标

Php 以木材(WordPress)作为特定页面模板的目标,php,wordpress,timber,Php,Wordpress,Timber,我试图用一个木材文件(.twig)在特定页面上输出一些HTML内容。我可以在主页上输出内容,但不能在特定页面上输出 我尝试了以下代码: % if fn (is_page('proprietes')) %} <h5 class="widget__headline">Test</h5> {% endif %} %如果fn(是页面('proprietes'))%} 试验 {%endif%} 但我最终得到了一张空白的纸。我可能犯了个语法错误 感谢您的帮助。尝试

我试图用一个木材文件(.twig)在特定页面上输出一些HTML内容。我可以在主页上输出内容,但不能在特定页面上输出

我尝试了以下代码:

% if fn (is_page('proprietes')) %}
    <h5 class="widget__headline">Test</h5>
    {% endif %}
%如果fn(是页面('proprietes'))%}
试验
{%endif%}
但我最终得到了一张空白的纸。我可能犯了个语法错误


感谢您的帮助。

尝试使用id而不是slug,例如:

{% if fn (is_page(7)) %}
    <h5 class="widget__headline">Test</h5>
{% endif %}
{%if fn(是第(7)页))%}
试验
{%endif%}
正确的方法:

{% if fn('is_page', page) %}

“页面”可以是slug/id/id数组等。

proprietes拼写正确吗?你错过了第一次吗?