I want to create a different design for all new and existing pages, with the exception of the frontpage.

The new design includes another subheader, container, and an extra subfooter.

My guess was to edit footer.php/header.php in my child theme directly, and create seperate subheader/footer/container for these pages, and apply them as follows:

<?php if ( is_home() || is_front_page()){
<div class="subheader_front"></div>                     
else {     
<div class="subheader"></div>
} ?>

Is this a correct way of applying a new design, or could this be done simpler?


You can create template files named front-page.php and home.php, which will be automatically loaded. See the Template Hierarchy for details.

You can also set up different headers for different template files. For instance, if you have a Home Page template home.php, you can have a separate header file loaded in it.

In your home.php file, you can pass a parameter to your get_header() call -- for example, get_header( 'home' ). This will look for a file named header-home.php, and load it if it exists. Failing that, it will load the default header.php file instead. You can do the same with your get_footer() and get_sidebar() calls.

Codex Pages

Template Hierarchy

  • You can do a lot with the Template Hierarchy. It's an amazing system.
    – Pat J
    May 25 '13 at 16:12
  • just to make it clear, I don't have a home.php or front-page.php at this moment. As I don't use the blog, I would have to create a front-page.php. In this page I put get_header() etc. Then It will automatically be loaded as the frontpage. Is this correct?
    – Forza
    May 25 '13 at 17:06
  • Yes, if you create a file called front-page.php, it will be used as your site's front page. I usually copy page.php to front-page.php and then make the necessary modifications to front-page.php (ie, header, footer, content, etc.).
    – Pat J
    May 25 '13 at 17:19
  • Ok, thx Pat! You're the best!
    – Forza
    May 25 '13 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.