I am developing a WordPress template (or rather trying to) and need a bit of help/advice.

I have a template that consists of a header (inc nav), footer, main content area.

The main content area has two columns - the left column for a sub-menu and the right for content, as demonstrated by the crude diagram linked below. The right content area contains several more rows and columns which are different for most pages of the site - some have a series of rows and columns, others have a single row/column.

I'm wondering what the best way to create these templates are - do I create several templates, each accommodating the different structure or is there a better way? The only thing that is inconsistent between each page is the right hand column (purple area), and it seems a shame to duplicate the entire page into a new template just because of this one inconsistent area, especially more so if I have different styles within the content area.

I've added a screenshot to demonstrate two possible layouts!

Edit: I don't have the required 10 reputation to post images unfortunately, so image is located here:

enter image description here

  • Have a look at the Template Hierarchy. How will you determine what template gets loaded? Category, tags, ...?
    – Pat J
    Commented Jul 5, 2013 at 16:02

1 Answer 1


Your consistent/common areas are:

  • Header (Including nav)
  • Footer
  • Sidebar

So you can easily make them accordingly to:

  • header.php - get_header();
  • footer.php - get_footer();
  • sidebar.php - get_sidebar();

And the right content area, as it is inconsistent, so it can be separated into a different page as:

  • content.php (general template)
  • content-double.php (template 1)
  • content-page.php (template 2)
  • etc.

And to include them just put the following code accordingly:

<?php get_template_part('content', ''); ?>
<?php get_template_part('content', 'double'); ?>
<?php get_template_part('content', 'page'); ?>

In this way you can part your template into various particles and can include them where necessary. Any question is highly recommended with thanks. :)

  • my index.php template contains the three includes for header, footer and sidebar. I see what you mean about separating the inconsistent areas into includes, thank you for the suggestion. I suppose my next question would be that if I used content-double.php twice on my site but need to change only an image in one of the columns, would I need to create two versions of content-double one for each image? Commented Jul 5, 2013 at 19:29
  • You can put the minor changes into a single file with conditional tags: if ( is_page( $page ) ) (Reference here)... Commented Jul 5, 2013 at 19:38
  • 1
    I honestly would upvote you for all the help you've provided, but I need 15 reputation sigh I'm marking this question as answered. Hopefully this will help others :) Commented Jul 5, 2013 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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