1

SMThemesをダウンロードしました。これは wordPress に似ています。

ただし、ファイルをコピーしたため、index.php正しく実行されません

<?php 
    global $SMTheme;

    get_header(); 

    get_template_part('theloop');

    get_template_part('navigation');

    get_footer();

?>

get_headerが定義されている場所が見つかりません。

にはそのような機能はなく、フォルダfunctions.phpもありません。includes

4

1 に答える 1

2

In fact, SMThemes is a WordPress theme. See the comment at the end of the link.

get_header() is defined in the WordPress core itself and not in the theme files, due this you weren't able to find it there.

You can find its definition at wp-installation-root/wp-includes/general-template.php file, Line 24, and its definition is:

/**
 * 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');
}

As of your real question, you can follow @SteAp suggestion and give PHPStorm a try, its very nice indeed and this kind of issues you will solve them easily (I don't work for JetBrains).

于 2013-08-31T01:27:48.817 に答える