Theme development question regarding layouts

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.

Read More

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

Related posts

1 comment

  1. Your consistent/common areas are:

    • Header (Including nav)
    • Footer
    • Sidebar

    So you can easily make them accordingly to:

    • header.phpget_header();
    • footer.phpget_footer();
    • sidebar.phpget_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. 🙂

Comments are closed.