为Wordpress自定义页面模板赋予外观编辑器标题

问题描述:

在Wordpress主题外观编辑器中时,某些页面的主题文件右侧列表中显示有简洁的标题。例如page.php显示为页面模板。这是干净的,很容易阅读。

When in Wordpress theme appearance editor, certain pages have a neat titles displayed in the right hand list for your theme files.For example page.php shows as "Page Template". This is clean and easily read.

Wordpress是否使用任何注释语法为我的自定义页面模板提供这些标题?

Is there any comment syntax that Wordpress uses to give these titles for my custom page template?

例如,我的single-video.php页面可能是视频页面模板。

For example, my single-video.php page could be "Video Page Template".

是的。确保您的页面打开时显示以下内容:

Yes you can. Make sure your page opens with something like:

<?php /** Template Name: Text & Image 
*/ get_header(); ?>

在这种情况下,文件概述(在外观编辑器中)中的文件名:文本&图片页面模板

In this case the name of the file in your file overview (while in your appearance editor): Text & Image Page Template