首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未定义get_header函数

未定义get_header函数
EN

WordPress Development用户
提问于 2020-09-08 17:51:03
回答 1查看 94关注 0票数 0

我根据网站https://ipipe.ru/info/ustanovka-wordpress-na-openserver安装了wordpress,然后想要使用underscores.me,在那里我输入了underscores.me并按下了generate按钮(结果,一个请求似乎覆盖了wordpress文件)。

致命错误:未定义错误:调用C:\OSPanel\domains\worldelectronics.ru\index.php:15堆栈跟踪中的未定义函数get_header():#0 {main}抛出在第15行的C:\OSPanel\domains\worldelectronics.ru\index.php中

下面是index.php文件

代码语言:javascript
复制
    <?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();

如何将取自underscores.me的世界电子产品主题的主页显示出来?

EN

回答 1

WordPress Development用户

发布于 2020-09-08 18:29:06

您下载的不是WordPress的替代品,而是一个主题。主题需要进入wp-content/themes文件夹中。一旦主题文件夹被正确放置,它应该作为一个选项出现在主题菜单中的WP管理,在那里你可以预览和激活它。

同时,您需要重新安装WordPress,以消除通过用主题覆盖根而造成的损害。您应该在wp-adminwp-includes或顶层修改文件的唯一时间是在更新到新版本的WordPress时(唯一的例外是wp-config.php )。所有的定制和添加都位于wp-content/themeswp-content/plugins文件夹中的主题和插件中。

票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/374506

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档