WordPress.org

Ready to get started?Download WordPress

Forums

Figuring out how to build my Main Index Template (3 posts)

  1. onekea
    Member
    Posted 4 years ago #

    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.

    Thanks!

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    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(); ?>

  3. onekea
    Member
    Posted 4 years ago #

    Awesome!! That helps a ton!

Topic Closed

This topic has been closed to new replies.

About this Topic