0
如何在模板中声明区域以在其他模板文件中使用?模板中的多个块
基本上,我想要我的模板中的2个区域用于container
和container-fluid
类型的引导程序。
现在我宣布一个div在header.php
文件container
类,并关闭在footer.php
。所以一切都在div是container
DIV中。
在Twig
我可以使用下面的语法:
<div class="container">
{% block container %}
{% endblock %}
</div>
<div class="container-fluid">
{% block container-fluid %}
{% endblock %}
</div>
和子模板只是把内容块
{% block container-fluid %}
// my content
{%endblock %}
听起来[get_template_part()](HTTPS ://developer.wordpress.org/reference /功能/ get_template_part /)。 –