如何将php文件添加到wordpress主题添加标准文件?

问题描述:

Wordpress 主题具有标准文件,例如 header.php、footer.php、index.php、functions.php、style.css、...如何将php文件添加到wordpress主题添加标准文件?例如我想添加一个 news.php 来显示其中的特定帖子,请帮帮我

Wordpress themes have standard file such as header.php, footer.php, index.php, functions.php, style.css, ... How to add a php file to wordpress theme addition of standard files? for example I want add a news.php to display specific posts in it, please help me

只需添加一个新文件(例如news.php),并将模板注释放在最开始:

Just add a new file (e.g. news.php), and put the template comment at the very beginning:

<?php
/*
Template Name: News Template
*/

然后,转到您的 Wordpress 后端,创建一个新页面,然后选择您创建的模板:

Then, go to your Wordpress backend, create a new page, and select the template you created: