Support » Fixing WordPress » template hierarchy problem

  • Suppose you have the following in your custom theme folder:

    • an empty index.php
    • valid header.php
    • valid footer.php
    • home.php with all the content, template name “home”
    • page.php with the code below
    • <?php
      get_header();
      
      while ( have_posts() ) : the_post();
      
            the_content();
      
      endwhile;
      
      get_footer();
      ?>

      If you open your website it shows the home.php without header and footer.
      So you go to pages -> add new -> template “home”
      and you go to settings -> reading -> set static front page to home.

      And it still shows just the homepage content without header and footer. Why is it not using page.php to generate the full page with header and footer?

  • The topic ‘template hierarchy problem’ is closed to new replies.