WordPress.org

Forums

template hierarchy problem (1 post)

  1. Saman88
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic