簡體   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