Wordpress 独立主题 - 安装时缺少模板

问题描述 投票:0回答:1

我正在尝试将 Vscode 与 cpanel 结合使用,并创建自定义主题。我能够异步连接一切。但是,我收到这个奇怪的错误:

Template is missing. Standalone themes need to have a templates/index.html or index.php template file. Child themes need to have a Template header in the style.css stylesheet.

我的文件路径结构如下: wp-内容->主题->mytheme->模板->index.html

我的 CSS 文件的文件路径是: wp-内容主题->mytheme->style.css

在我的 style.css 里面我只有:

Theme Name: mytheme
wordpress cpanel
1个回答
0
投票

如果您的主题不是块主题,那么您需要在主题文件夹的根目录中使用

index.php
。如果是块主题,则需要
templates/index.html

请参阅

WP_Theme::is_block_theme()
方法,了解确定主题是否为块主题的逻辑。

在您的情况下,虽然该文件可能存在,但 WordPress 可能无法读取。检查文件的权限,并根据需要进行调整。

© www.soinside.com 2019 - 2024. All rights reserved.