Undefined get_header function

时间:2020-09-08 作者:vladdv861 dvin

我根据网站安装了wordpresshttps://ipipe.ru/info/ustanovka-wordpress-na-openserver 然后想用下划线。我进入worldelectronics并按下generate按钮(结果,一个请求似乎覆盖了wordpress文件)。

致命错误:未捕获错误:调用C:\\OSPanel\\domains\\worldelectronics中未定义的函数get\\u header()。ru \\索引。php:15堆栈跟踪:#0{main}在C:\\OSPanel\\domains\\worldelectronics中抛出。ru \\索引。php在线15

以下是索引。php文件

    <?php
    /**
     * The main template file
     *
     * This is the most generic template file in a WordPress theme
     * and one of the two required files for a theme (the other being style.css).
     * It is used to display a page when nothing more specific matches a query.
     * E.g., it puts together the home page when no home.php file exists.
     *
     * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
     *
     * @package WorldElectronics
     */

    get_header();
    ?>

        <main id="primary" class="site-main">

            <?php
            if ( have_posts() ) :

                if ( is_home() && ! is_front_page() ) :
                    ?>
                    <header>
                        <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
                    </header>
                    <?php
                endif;

                /* Start the Loop */
                while ( have_posts() ) :
                    the_post();

                    /*
                     * Include the Post-Type-specific template for the content.
                     * If you want to override this in a child theme, then include a file
                     * called content-___.php (where ___ is the Post Type name) and that will be used instead.
                     */
                    get_template_part( \'template-parts/content\', get_post_type() );

                endwhile;

                the_posts_navigation();

            else :

                get_template_part( \'template-parts/content\', \'none\' );

            endif;
            ?>

        </main><!-- #main -->

    <?php
    get_sidebar();
    get_footer();
如何从下划线中获取worldelectronics主题的主页。要显示的me?

1 个回复
SO网友:Tom J Nowell

你下载的不是WordPress的替代品,而是一个主题。主题需要深入wp-content/themes 文件夹主题文件夹正确放置后,应作为选项显示在WP Admin的主题菜单中,您可以在其中预览和激活它。

同时,您需要重新安装WordPress,以修复因使用主题覆盖根目录而造成的损坏。在中修改文件的唯一时间wp-admin, wp-includes 或者在顶层,当您更新到WordPress的新版本时(唯一的例外是wp-config.php ). 所有定制和添加都包含在位于wp-content/themeswp-content/plugins 文件夹。