2014-09-25 32 views

回答

2

WordPress的保持路徑添加到當前模板在全球$template變量。

function display_template_path() { 
    global $template; 
    echo '<pre class="debug">'; 
    echo $template; 
    echo '</pre>'; 
} 
add_action('wp_footer' , 'display_template_path'); 
+0

真棒,這工作,我現在看到我的網頁使用了錯誤的PHP模板。它使用category.php,但應該使用category-product.php。你知道這是哪個文件嗎? – Brendan 2014-09-25 18:01:25

+0

WordPress解析查詢並根據[模板層次結構](http://codex.wordpress.org/Template_Hierarchy)計算出要使用的模板。檢查「產品」類別是否有預期的slu。。 – 2014-09-26 12:03:46