2013-08-31 37 views
1

我下載了SMThemes。它有點類似wordPress。有沒有任何IDE來瀏覽多個PHP和CSS文件?

然而,當我複製文件的index.php不正確執行

<?php 
    global $SMTheme; 

    get_header(); 

    get_template_part('theloop'); 

    get_template_part('navigation'); 

    get_footer(); 

?> 

我找不到get_header被定義在哪裏。

functions.php中沒有這樣的功能,並且沒有includes文件夾。

+0

請下載PHPStorm的評估副本,將源加載爲項目並使用IDE自動查找get_header()的定義。 – SteAp

回答

2

其實,SMThemesWordPress主題。請參閱鏈接末尾的評論。

get_header()定義在WordPress核心本身,而不是在主題文件中,因爲你無法在其中找到它。

您可以在wp-installation-root/wp-includes/general-template.php文件中找到它的定義,線24,它的定義是:

/** 
* Load header template. 
* 
* Includes the header template for a theme or if a name is specified then a 
* specialised header will be included. 
* 
* For the parameter, if the file is called "header-special.php" then specify 
* "special". 
* 
* @uses locate_template() 
* @since 1.5.0 
* @uses do_action() Calls 'get_header' action. 
* 
* @param string $name The name of the specialised header. 
*/ 
function get_header($name = null) { 
    do_action('get_header', $name); 

    $templates = array(); 
    $name = (string) $name; 
    if ('' !== $name) 
     $templates[] = "header-{$name}.php"; 

    $templates[] = 'header.php'; 

    // Backward compat code will be removed in a future release 
    if ('' == locate_template($templates, true)) 
     load_template(ABSPATH . WPINC . '/theme-compat/header.php'); 
} 

隨着你的真正的問題,你可以按照@SteAp建議,並給予PHPStorm一個嘗試,它很確實很好,這種問題你會很容易解決(我不適用於JetBrains)。

相關問題