Scratch wordpress 主题未显示 page.php 的页面内容

Scratch wordpress theme is not showing page content for page.php

我正在从头开始制作 Wordpress 主题。我的 page.php 不是 showing/loading Lorem 页面内容

//page.php
  get_header(); ?>
    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">
            <?php while ( have_posts() ) : the_post(); ?>
                <?php get_template_part( 'content', 'page' ); ?>
                <?php if ( comments_open() || get_comments_number() ) : ?>
                    <?php comments_template(); ?>
                <?php endif; ?>
            <?php endwhile; ?>
        </main><!-- #main -->
    </div><!-- #primary -->
    <?php get_sidebar(); ?>
    <?php get_sidebar( 'tertiary' ); ?>
    <?php get_footer(); ?>

我有

   //header.php

    <!DOCTYPE html>
    <html>
    <head>
    <?php wp_head();?>
    </head>
    <body>
    <h1>Test Header</h1>

    </html>

另一个

//functions.php      
<?php
    function remove_posts_menu() {
        remove_menu_page('edit.php');
    }
    add_action('admin_menu', 'remove_posts_menu');

    function add_taxonomies_to_pages() {
        // register_taxonomy_for_object_type( 'post_tag', 'page' );
        register_taxonomy_for_object_type( 'category', 'page' );
        }
       add_action( 'init', 'add_taxonomies_to_pages' );



    if ( ! is_admin() ) {
        add_action( 'pre_get_posts', 'category_and_tag_archives' );

        }
    function category_and_tag_archives( $wp_query ) {
       $my_post_array = array('post','page');

        if ( $wp_query->get( 'category_name' ) || $wp_query->get( 'cat' ) )
        $wp_query->set( 'post_type', $my_post_array );

        if ( $wp_query->get( 'tag' ) )
        $wp_query->set( 'post_type', $my_post_array );
       }

    function remove_page_attribute_support() {
        remove_post_type_support('page','page-attributes');
    }
    add_action( 'init', 'remove_page_attribute_support' );

在 functions.php 中,我在管理菜单中禁用了 post,并为页面启用了分类法。

不对的地方请指正

请尝试以下操作: 头:

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <?php wp_head(); ?>
</head>
<body>

函数: 使用您的默认主题功能 twentytwelve 或更高版本

page.php

<div>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>
</div>
<?php get_footer(); ?>

实际上是从另一个主题复制代码 -

页面未呈现的主要原因是page.php正在调用其他主题模板文件来显示内容。

但是 scratch 主题在 WebPage content-xx.php

中没有内容文件夹,也没有用于渲染内容的额外模板
//page.php   
 <?php   
    get_header(); ?>
    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">
            <?php while ( have_posts() ) : the_post(); ?>
                <?php the_content();?>
             <?php endwhile; ?>
        </main><!-- #main -->
    </div><!-- #primary -->
    <!-- <?php get_sidebar(); ?> -->

    <?php get_footer(); ?>

最终呈现 lorem-imsum 页面