如何将php文件添加到wordpress主题添加标准文件? [英] How to add a php file to wordpress theme addition of standard files?

查看:27
本文介绍了如何将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:

这篇关于如何将php文件添加到wordpress主题添加标准文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆