Title: Theme document structure
Last modified: August 30, 2016

---

# Theme document structure

 *  [Andy](https://wordpress.org/support/users/ajmacleod/)
 * (@ajmacleod)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/theme-document-structure/)
 * _[ Moderator note: [moved to How-to and Troubleshooting](https://wordpress.org/support/topic/wheres-my-topic-gone?replies=1&view=all).]_
 * Hi!
 * I love theming with WordPress. However, I have a question/request about template
   document structure…
 * It is usual to find open tags in header.php which are subsequently closed in 
   footer.php. I’m not keen on this. I like each template file to have their closing
   tags included too. For example, this is the code from my current theme’s index.
   php:
 *     ```
       <!doctype html>
       <html>
         <head>
           <?php get_template_part('head'); ?>
           <?php wp_head(); ?>
         </head>
         <body>
           <div class="top"> <!-- necessary to produce the sticky footer -->
             <?php get_header(); ?>
             <?php get_template_part('feature'); ?>
             <?php get_template_part('content'); ?>
           </div> <!-- .top -->
           <div class="bottom"> <!-- wrapper for the sticky footer -->
             <?php get_footer(); ?>
           </div> <!-- .fullwidth bottom -->
           <?php wp_footer(); ?>
         </body>
       </html>
       ```
   
 * I realise that the usual approach involves slightly fewer template files compared
   to this. However, I’d argue that this approach makes for a much more readable/
   user friendly document structure. The outline of the page is complete, and each
   template file is a discrete section of code.
 * You may be wondering why I didn’t put wp_head() in head.php… I did it because,
   from my approach, wp_footer() can’t get into footer.php. I like parity. (Both
   header.php and footer.php only include page content that is used on every page).
 * I’d like to know how the current practice evolved, and whether anyone else has
   my OCD compulsion to close tags in template files.

Viewing 1 replies (of 1 total)

 *  Thread Starter [Andy](https://wordpress.org/support/users/ajmacleod/)
 * (@ajmacleod)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/theme-document-structure/#post-6611756)
 * (Not sure why my post was moved here… I’m not looking for help. I wanted to float
   the idea of changing the convention in template document structure to see what
   others thought about it).

Viewing 1 replies (of 1 total)

The topic ‘Theme document structure’ is closed to new replies.

## Tags

 * [structure](https://wordpress.org/support/topic-tag/structure/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Andy](https://wordpress.org/support/users/ajmacleod/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/theme-document-structure/#post-6611756)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
