我有一个运行在RunCloud/digital ocean上的WP多站点。我已经尝试了四到五个自定义主题,但每一个都会在一两个小时后从我的主题菜单中消失。
今天,我尝试了子主题,也得到了同样的结果。这是我的twentytwenty child/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' ); ...as per developer.wordpress.org,将文件夹名称重命名了两次(恢复为原来的名称),但没有成功。子主题将不会出现在管理菜单中。
子文件夹(twenty20- style.css /)只有style.css、functions.php和header.php。所有可用的主题,包括twentytwenty,都在多站点网络上启用。
我是不是漏掉了什么明显的东西?我是WP主题创作的新手,请原谅我的无知。谢谢!
发布于 2019-11-17 02:54:07
好了,我想我想通了。关于它是由RunCloud引起的,Chris说了些什么。我将新的子文件夹和文件‘chown’到runcloud:runcloud (与现有的主题文件夹和文件所有权相匹配),它们重新出现了!
作为确认,我还在一个工作主题文件夹(twentynineteen)上运行了'chown root:root‘。该文件夹很快就从wp-admin菜单中消失了。
默认主题文件夹和我自己创建的子主题的权限是相同的。因此,RunCloud必须拥有WordPress文件的所有权才能读取它们。
https://stackoverflow.com/questions/58886838
复制相似问题