从单独的主题派生子主题

时间:2017-01-26 作者:Max

现在,我有一个网站正在使用Genesis主题。我正在尝试创建一个儿童主题,但我不想经历所有这方面的工作。目前,我已经下载了一个普通的主题——gridz,我想把它变成一个子主题。

到目前为止,我尝试的是添加Template: genesis 到样式的底部。css头部,如下所示。

  /*
Theme Name: Gridz
Theme URI: http://appswp.net/gridz-wordpress-theme/
Author: AppsWP
Author URI: http://www.appswp.net
Description: Pinterest like personal blogging theme powered by jQuery Masonry. Beautiful retina-ready and responsive theme with flexible layout. Tons of options to customize the theme according to your needs
Version: 1.0.5
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, white, one-column, two-columns, right-sidebar, left-sidebar, fluid-layout, responsive-layout, custom-colors, custom-background, custom-header, custom-menu, editor-style, featured-images, post-formats, sticky-post, translation-ready, theme-options
Text Domain: gridz
Template: genesis
*/
当我安装主题时,它会注册为主题。然而,当我尝试激活主题时,整个网站都会出现一个HTTP 500 error.

我觉得这个问题似乎来自于功能。php,但我不知道问题出在哪里。现在,功能。php文件的长度超过800行,但我将只显示一个函数,因为它可以帮助您了解导致此错误的原因。

    /**
 * Filters Title for the Site
 */
function gridz_filter_wp_title($title) {
    $site_name = get_bloginfo(\'name\');
    if(trim($title) != \'\') {
    $title = str_replace(\'»\',\'\',$title);
    $filtered_title = $title.\' | \'.$site_name;
    } else
    $filtered_title = $site_name;
    if (is_front_page()) {
        $site_description = get_bloginfo(\'description\');
    if(trim($site_description) != \'\')
        $filtered_title .= \' | \'.$site_description;
    }
    return $filtered_title;
}
另请注意,每个页面的顶部都有一些代码:

/**
 * @package gridz
 */
我已经尝试删除上面的代码,但仍然发生内部服务器错误。目前,我不知道下一步该做什么。

2 个回复
最合适的回答,由SO网友:Fabio Marzocca 整理而成

我不明白你的目标。如果你想创建一个孩子的主题,这是很容易和向前迈进;只需遵循以下简单规则:https://codex.wordpress.org/Child_Themes

与功能无关。如果要设置独立的子主题,请不要编辑主主题的php。

SO网友:Christina

看起来您想使用genesis父框架,但要使用另一个不是genesis子主题的主题,并将其变成genesis的子主题。你不能那样做。如果您对CSS有深入的了解,您可以重新设置Genesis子主题的样式,使其看起来类似,但不能将父主题用作父主题的子主题。

相关推荐

Child-theme breaks site

所以,我有一个子主题,里面除了所需的CSS文件之外什么都没有。一旦我激活了这个儿童主题,我的整个网站就关闭了。最后我有两个问题:激活一个只有CSS的子主题怎么能破坏我的网站</我怎样才能回到我原来的主题</这些是网站给我的错误:Warning: require_once(/wp-content/themes/interio_child/admin/options-framework.php) [function.require-once]: 无法打开流:中没有此类文件或目录/wp-c