WordPress.org

Ready to get started?Download WordPress

Forums

template hierarchy problem (1 post)

  1. Saman88
    Member
    Posted 6 months 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?

Reply

You must log in to post.

About this Topic