• Im kinda new to WordPress and been using it mostly to learn about theme creation, my so called “blog” mostly has lorem ipsum in it. AS I said im just trying stuff here…

    My WordPress book and the Codex both say that the most basic theme included a least the index.php header.php footer.php and sidebar.php. And I did my first really basic theme following this rule.

    But I have discover that I can replace these by other with the include command or even not have them at all (sidebar in a page).

    So I asked myself if I could create a template with only one php document. I pasted the my header and footer code directly in a template creating a single file template, and evrything seem to work fine, WordPress does not seem to mind at all.

    I can see the clear advantage of using a header.php and footer.php file when the same header and footer is the same across many template. But If I have a template with a unique header it seem more logical to put everything in one template file rather then three or four files.

    Is there something wrong with doing a template this way?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Is there something wrong with doing a template this way?

    no, as long as you dont intend to share it, and as long as you are aware of the fact that some plugins look for functions that are, as a rule, located within those files… wp_footer, for example.

    The header and footer are not necessary. They do have useful parts-

    Header
    DOCTYPE
    All head info- style, meta, links, title
    This code-

    <div class=page_container>
    <body><div id="content">

    Footer
    This code-
    </div>
    and
    <?php get_sidebar(); ?> if you want the sidebar.

    [signature moderated Please read the Forum Rules]

    @tapeboy — those could all be in one file too.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do I really need to use header.php and footer.php?’ is closed to new replies.