【发布时间】:2017-08-18 22:20:25
【问题描述】:
我们为我们的主网站安装了具有自己主题的 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 安装主题?
【问题讨论】:
标签: php wordpress wordpress-theming