[英]How to call a page template in another page in php- Wordpress?
OK. 好。 I have page template called "bannerpage.php".
我有一个名为“ bannerpage.php”的页面模板。 How do I call this page so that the contents of this page are displayed on the homepage.php
我如何称呼此页面,以便该页面的内容显示在homepage.php上
I know that most common templates that have associated template tags (ie, , , , etc.), can be called but I don't know how to call a "non-standard" template like bannerpage.php in Wordpress. 我知道可以调用具有关联模板标签(即,,等等)的最常见模板,但是我不知道如何在Wordpress中调用诸如bannerpage.php之类的“非标准”模板。
Any help would be much appreciated. 任何帮助将非常感激。
在homepage.php
文件中添加include('bannerpage.php');
The best way is to select the your page template from the backend page. 最好的方法是从后端页面选择页面模板。
Or..You can also include it in ome page by : 或者..您也可以通过以下方式将其包括在ome页面中:
include('bannerpage.php');
Use get_template_part(); 使用get_template_part();
Load a template part into a template (other than header, sidebar, footer).
将模板零件加载到模板中(标题,侧边栏和页脚除外)。 Makes it easy for a theme to reuse sections of code and an easy way for child themes to replace sections of their parent theme.
使主题易于重用代码部分,并使子主题易于替换其父主题的部分。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.