WordPress.org

Forums

[resolved] Is it wrong to build a theme completely in index.php? (7 posts)

  1. pineconez
    Member
    Posted 2 years ago #

    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:

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

    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.

  2. Andrew
    Forum moderator & snail smusher
    Posted 2 years ago #

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

  3. pineconez
    Member
    Posted 2 years ago #

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

  4. Andrew
    Forum moderator & snail smusher
    Posted 2 years ago #

    There's nothing wrong with this.

  5. pineconez
    Member
    Posted 2 years ago #

    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?

  6. hieu.nguyen
    Member
    Posted 2 years ago #

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

    So it's not wrong :-)

  7. pineconez
    Member
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic