Support » Themes and Templates » Figuring out how to build my Main Index Template

  • I’m building my first “from scratch” WP theme and I’m having a bugger of a time figuring this little goody out.

    I’ve created my site in html/css and it looks wonderful. Now my site is broken apart as follows:

    header.php (the standard header)
    mainpic.php (the main image for the site)
    maincontent.php (this would be my left column / main elements)
    secondarycontent.php (this is my sidebar with banners, etc.)
    lowerbody.php (this is a section that has three columns for more banners)
    footer.php (the standard footer)

    Now I’m trying to break these apart so that it plays nicely with WP and so far my index.php looks like this…

    <?php get_header(); ?>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    What I need to know is how would I add an element to this structure?
    For example, adding a <?php get_maincontent(); ?> above the sidebar that will contain the WP look, or <?php get_lowerbody(); ?> above the footer to add the extra section there.

    As it is, I have these chopped up and put in these three elements but it doesn’t leave me a lot of options.

    Any light on this subject would be awesome.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael


    Forum Moderator

    if you want to follow you structure, you could use <?php include(TEMPLATEPATH . '/yourfile.php'); ?> at the corresponding places.

    your index.php could then look like:

    `<?php get_header(); ?>
    <?php include(TEMPLATEPATH . ‘/mainpic.php’); ?>
    <?php include(TEMPLATEPATH . ‘/maincontent.php’); ?>
    <?php include(TEMPLATEPATH . ‘/secondarycontent.php’); ?>
    <?php include(TEMPLATEPATH . ‘/lowerbody.php’); ?>
    <?php get_footer(); ?>

    Awesome!! That helps a ton!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Figuring out how to build my Main Index Template’ is closed to new replies.