制作第一个WordPress主题,循环和模板功能无法正常工作


making first wordpress theme, the loop and template functions not working properly

我正在按照本教程进行操作,到目前为止我所做的工作并没有正常工作。我已经到了开始使用循环的地步 - 这是我的代码:

索引.php

<?php get_header(); ?>
  <div class="row">
    <div class="col-sm-8 blog-main">
      <?php 
      if ( have_posts() ) : while ( have_posts() ) : the_post();
        get_template_part( 'content', get_post_format() );
      endwhile; endif; 
      ?>
    </div><!-- /.blog-main -->
    <?php get_sidebar(); ?>
  </div><!-- /.row -->
  <?php get_footer(); ?>
</div><!-- /.container -->`

内容.php

<div class="blog-post">
    <h2 class="blog-post-title"><?php the_title(); ?></h2>
    <p class="blog-post-meta"><?php the_date(); ?><a href="#"><?php the_author(); ?></a></p>
    <?php the_content(); ?>
</div><!-- /.blog-post -->

我有两个帖子,但只有最新的帖子被显示(通过循环)和显示的帖子中 - 唯一显示的部分是标题。因此,似乎the_date()the_author()the_content()函数由于某种原因不起作用,并且循环仅获取其中一个帖子(最新的帖子)。

怎么了?谢谢。

我不确定我做了什么,但我去了 WP 管理员并单击主题的"自定义",它在主题编辑器中正确加载 - 然后我去了网站,它正在工作。我想也许我没有保存文件,也没有意识到这一点 - 当我试图弄清楚它时,我最终保存了文件,它开始工作。