2013-07-04 30 views
-1

是否可以使用「get_template_part」更改「require_once」?如何使用「get_template_part」更改「require_once」

在我的WordPress的文件,我試圖改變這一行:

function upthemes_admin_home() {require_once('home.php');} 

是這樣的:

function upthemes_admin_home() {get_template_part('home'); } 

但沒有奏效。任何人,請幫助。 感謝您的好意。

回答

0

你能解釋「沒有工作」嗎?你有什麼信息嗎?也請嘗試在您的主題文件中放置

get_template_part('home'); 

並檢查它是否正常工作。我想你知道get_template_part()是相對於活動主題目錄,所以它會檢查這樣的文件:

/wp-content/themes/active_theme/home.php 
+0

是的BebliucGeorge。你是對的,我弄錯了路徑。謝謝 –