我有一个在RunCloud /数字海洋上运行的WP多站点。我尝试了四个或五个自定义主题,但是一两个小时后,每个主题都会从主题菜单中消失。
今天,我尝试使用子主题的结果相同。这就是我的二十二十岁儿童/style.css中的内容:
/*Theme Name: level up child
*Description: child theme of 2020
*Template: twentytwenty
*/
@import url("../twentytwenty/style.css");
但是,一旦我创建了header.php(将父标头复制到子文件夹中),我的子主题就消失了。从那以后,我已经在子文件夹中添加了functions.php文件,并添加了以下内容...
function twentytwenty_child_enqueue_styles() {
// Parent theme style handle
$parent_style = 'twentytwenty-style';
// Enqueue parent and child theme style.css.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child_style', get_stylesheet_directory_uri() . '/style.css',
array($parent_style), wp_get_theme()->get('Version'));
};
add_action( 'wp_enqueue_scripts', 'twentytwenty_child_enqueue_styles' );
...按照developer.wordpress.org,将文件夹名称重命名两次(恢复为原始名称),并且没有运气。子主题不会出现在管理菜单中。
子文件夹(twentytwenty-child /)仅具有style.css,functions.php和header.php。在多站点网络上启用了所有可用的主题,包括20个。
我缺少明显的东西吗?我是WP主题创建的新手,请原谅我的无知。谢谢!
答案 0 :(得分:0)
好吧,我想我明白了。 Chris可能是由RunCloud引起的。我将新的子文件夹和文件“小丑”为runcloud:runcloud(与现有主题文件夹和文件所有权相匹配),它们重新出现了!
为确认起见,我还在运行的主题文件夹(twentynineteen)上运行了“ chown root:root”。该文件夹很快从wp-admin菜单中消失了。
默认主题文件夹的权限与我自己创建的子主题的权限相同。因此,RunCloud必须要求拥有WordPress文件的所有权才能读取它们。