WordPress自定义模板页面不显示

问题描述

无法在页面属性模板中获得自定义创建的页面,其余所有页面显示在下拉菜单中,但未列出新创建的页面。我已经用PHP创建了一个自定义页面,并将其上传到根目录的wp-content->themes->my-theme中。

请帮助,谢谢

解决方法

在自定义页面的开头添加:

<?php

/*
Template Name: Template name
*/

?>

第二个模板名称将为您的模板名称

,

请确保您的模板文件名类似于page_ {template-name},而不是page- {template-name}。

还要在模板的开头添加它。

<?php /* Template Name: Example Template */ ?>

查看更多详情https://developer.wordpress.org/themes/template-files-section/page-template-files/