Support » Themes and Templates » Is it wrong to build a theme completely in index.php?

  • Resolved pineconez


    I have always built my themes (perhaps wrongly?) completely in my index.php file.
    So I don’t use tags like <?php get_header(); ?> or <?php get_footer(); ?> because I have no header.php or footer.php.

    My themes are always for myself, or built for a client who wont be adding plugins or anything like that, but I have recently ran into an issue with a certain plugin called JigoShop that isn’t seeming to play nice with my theme, and I am starting to think it’s because I’m not building with multiple files, or that it’s searching for something that it needs to see and I’m not adding.

    My setup more or less looks like this:

        <?php wp_head(); ?>
        <div id="wrapper">
            ... loop stuff ...
        <?php wp_footer(); ?>

    So I guess what I’m asking, is it wrong to build a theme completely in index.php?
    If not, what do I need to add to make a single file theme compliant with plugins?

    Thanks much!

    On a side note, I have gone through the jigoshop doc on how to get Jigoshop to play nicely with a theme, and fashioned my functions.php to this tutorial, based on my layout. I had slight results but the theme is still very broken on the Jigoshop page.

    I am really just trying to trouble shoot here, trying to rule out some things.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Andrew Nevins


    Forum moderator

    Which are you referring to, “the index.php file” in which directory?

    @andrew, that would be the index.php within my theme directory.
    Structure: ../wp-content/themes/MyTheme/index.php

    Moderator Andrew Nevins


    Forum moderator

    There’s nothing wrong with this.

    That’s good to know.
    Based on my above codeblock, besides the missing
    <?php get_sidebar();?>, would I have all the necessary items for plugins? Am I missing anything in that regard?

    The basic must-have files for a template are only: index.php and style.css.

    So it’s not wrong 🙂

    Thanks for the answers guys. Marked this as resolved.
    Is there any advantage to multiple part php sites?
    I don’t really understand the idea behind that, but it seems most use this technique.

    My idea on it has always been that it’s easier to have everything I need in one place, which is why I have always used this single file method.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is it wrong to build a theme completely in index.php?’ is closed to new replies.