简体   繁体   English

第二次安装的Wordpress子主题

[英]Wordpress child theme for second installation

We have WordPress installed for our main website with it's own theme. 我们已经为自己的主要网站安装了WordPress,并使用了自己的主题。 I now want to install another WordPress in a sub-folder where I want to use the main website's theme there. 现在,我想在子文件夹中安装另一个WordPress,并在其中使用主网站的主题。
So I've made a new theme which includes 3 files: 因此,我制作了一个包含3个文件的新主题:

index.php
style.css
functions.php

I'm referring to the main website theme files (header.php for example) in the new installation index.php file: 我指的是新安装的index.php文件中的主要网站主题文件(例如header.php):

    <?php
//Checking if file exist
if ( file_exists( get_stylesheet_directory() . '/../../../../wp-content/themes/First/header.php') ) {
    //Require file if it exist, 
    require_once( get_stylesheet_directory() . '/../../../../wp-content/themes/First/header.php' )
} else {
    /* Echo something if file doesn't exist, if the message wasn't displayed and you still get 500 error then there's some wrong on the php file above*/
    _e('File not found');
}
?>

However, this returns 500 error, anyways, Can I do something like this ? 但是,无论如何,这将返回500错误,我可以这样做吗? to use another WordPress installation themes on a new installation of WordPress in a folder? 在文件夹中新安装的WordPress上使用另一个WordPress安装主题?

Please use register_theme_directory() function and use absolute paths. 请使用register_theme_directory()函数并使用绝对路径。

Please also see this: https://wordpress.stackexchange.com/questions/83102/how-do-you-change-the-theme-location 另请参见: https : //wordpress.stackexchange.com/questions/83102/how-do-you-change-the-theme-location

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM