繁体   English   中英

第二次安装的Wordpress子主题

[英]Wordpress child theme for second installation

我们已经为自己的主要网站安装了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');
}
?>

但是,无论如何,这将返回500错误,我可以这样做吗? 在文件夹中新安装的WordPress上使用另一个WordPress安装主题?

请使用register_theme_directory()函数并使用绝对路径。

另请参见: 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