问题描述
我一直在创建模板,这些模板已经在wp-admin中的模板下拉列表中显示。但是,更新到wp 5.5版后,当我使用下面的示例代码创建模板时,它不会显示在wp-admin的模板列表中
<?php
/* Template Name: Reflection */
?>
我正在使用子主题,子主题和父主题都具有style.css和正确的主题版本。只是要补充一点,这是由aws托管的bitnami wordpress。 帮助将不胜感激。
这是子样式。css
/*
Theme Name: cbusiness-consult-lite-child
Theme URI: mybase.com/wp-content/themes/cbusiness-consult-lite-child
Description: My first child theme. Parent theme: cbusiness-consult-lite- child.
Version: 0.4.
Template: cbusiness-consult-lite
Text Domain: cbusiness-consult-lite-child
Tags: black,white,red,one-column,two-columns,right-sidebar,fluid-
layout,responsive-layout,photoblogging,left-sidebar,translation-ready,custom-background,custom-colors,custom-menu,featured-images,full-
width-template,post-formats,theme-options,threaded-comments
*/
@import url("../cbusiness-consult-lite/style.css");
这是父主题的style.css
中的几行 /*
Theme Name: CBusiness Consult Lite
Theme URI: https://www.themescave.com/themes/wordpress-theme-corporate-free- cbusiness-consult-lite/
Author: Themescave
Author URI: http://www.themescave.com/
Description: CBusiness Consult Pro WordPress has used for most of all type
of business including Business consultant,news,portfolio,blogs,etc. Its
used for the multipurpose business like Marketing,Finance,Stock Market,IT
infrastructure,Consultant,Manufacture plant,Services,Retailer,Wholesaler,Online business,Store,IT Firm,Cloth business,and many more
business. please check our demo http://themescave.com/demo/cbusiness-
consult-pro/. Documentation URL:
https://www.themescave.com/documentation/cbusiness-consult-pro/ & Pro theme
URL: https://www.themescave.com/themes/wordpress-theme-corporate-cbusiness-
consult-pro/ & Support Url:
https://www.themescave.com/forums/forum/cbusiness-consult-pro/;
Version: 0.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: cbusiness-consult-lite
Tags: custom-menu,threaded-
comments,blog,custom-
header,full-width-template,two-
columns,photography,sticky-post
CBusiness Consult Lite WordPress Theme,Copyright 2019
themescave(themescave.com)
CBusiness Consult Lite is distributed under the terms of the GNU GPL
*/
/*------------------------------------------------------------------
[Table of contents]
1. Main Tags
2. Accessibility
-------------------------------------------------------------------*/
/* Main Tags */
*{ margin:0; padding:0; outline:none;}
body{ margin:0; padding:0;line-height:20px; font-size:13px; color:#5c5c5c;
font-family:'PT Sans',Helvetica,sans-serif;}
ol,ul{ margin:0; padding:0;}
ul li ul,ul li ul li ul,ol li ol,ol li ol li ol{ margin-left:10px;}
h1,h2,h3,h4,h5,h6{ color:#484f5e; font-family:'raleway',sans-serif; margin:0
0 20px; padding:0; line-height:1.1; font-weight:400; }
h1{ font-size:32px;}
h2{ font-size:28px;}
h3{ font-size:23px;}
h4{ font-size:20px;}
h5{ font-size:18px;}
h6{ font-size:16px;}
img{ border:none; margin:0; padding:0; height:auto}
html,body { font-size: 15px; }
p{ margin:0; padding:0;}
a{ text-decoration:none; color:#5c5c5c;}
a:hover{ color:#333;}
解决方法
对于那些面临类似问题的人,我最终了解到,在主题根目录中创建模板后,该模板便可以工作,并且该模板在wp-admin中可见。我对此感到满意,但我认为应该有更好的解决方法。