Php 第二次安装的Wordpress子主题

Php 第二次安装的Wordpress子主题,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我们已经为我们的主网站安装了WordPress,它有自己的主题。我现在想在一个子文件夹中安装另一个WordPress,在那里我想使用主网站的主题因此我制作了一个新主题,其中包括3个文件: index.php style.css functions.php 我指的是新安装index.php文件中的主网站主题文件(例如header.php): <?php //Checking if file exist if ( file_exists( get_stylesheet_directo

我们已经为我们的主网站安装了WordPress,它有自己的主题。我现在想在一个子文件夹中安装另一个WordPress,在那里我想使用主网站的主题
因此我制作了一个新主题,其中包括3个文件:

index.php
style.css
functions.php
我指的是新安装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');
}
?>

请使用
注册主题目录()
函数并使用绝对路径


另请参见:

我应该在functions.php文件中使用此函数吗?