Basic Template Files

To generate such a structure within a WordPress Theme, start with an index.php template file in your Theme’s directory. This file has two main functions:

  • Include or “call” the other template files
  • Include the WordPress Loop to gather information from the database (posts, pages, categories, etc.)

For our simple structure, we only need to include two other template files: the header and the footer. These must be namedheader.php and footer.php. The Template Tags that include them look like this:

<?php get_header(); ?>


<?php get_footer(); ?>

In order to display the posts and pages of your blog (and to customize how they are being displayed), your index.php file should run the WordPress Loop between the header and footer calls.