Forums

Created a new theme...no need for index.php - this ok? (3 posts)

  1. CodeyMonkey
    Member
    Posted 5 months ago #

    Hi,

    I've created a new theme, I use home.php as my Index/Homepage

    single.php, page.php and archive.php handle the other pages, search works fine... everything in fact works great

    Because of this setup (which seems the right way to do it)... index.php has been left blank e.g. no code within.... everything seems fine, is this a normal practice?

    The reason I ask is I've never seen it before, yet, I don't know what to put in it, just to pacify having stuff in there (As it's not needed)

  2. Chip Bennett
    Member
    Posted 5 months ago #

    No, that won't work. The index.php template file is required, as it is the ultimate fallback for the Template Hierarchy, and you have not covered all of the other templates.

    Specifically:
    - Search results
    - Error 404

    I'm curious: why would you want to omit the index.php template file?

  3. CodeyMonkey
    Member
    Posted 5 months ago #

    It's not what I intended, but it's the way it's happened...

    home.php - is my homepage
    I use page for contact, portfolio blog index
    single-portfolio.php takes care of the single portfolio items
    single.php takes care of single blog posts
    archive.php, search.php, 404.php and pages.php take care of the rest...

    So you can see why index.php isn't needed with any code inside.

    It's fine, I have 404.php and search.php...search works fine, I have everything, even an index.php file.... there's just no code in it...

    Everything seems to work great....

    Shall I put some default code in there? Seems like I can leave it blank, just wondered if therer would be any repurcussions?

    [No bumping, thank you.]

Reply

You must log in to post.

About this Topic

Tags