Forums

[resolved] Here we go again: home.php vs front-page.php (10 posts)

  1. ixwa
    Member
    Posted 12 months ago #

    Sorry for what must seem to be a blisteringly obvious distinction, but to this WP newbie I still haven't managed to figure out (from all the forum posts and various other Q&A's I've read) what the difference is between these two pages. (I've seen the template hierarchy, but this hasn't helped.)

    Let's pretend I'm just building a simple website, with no "blog". What is my "home page"? home.php or front-page.php?

    I also have an index.php file in my themes folder (it only calls header/footer) but this never gets used, even for generic, one-off posts. Am I missing something?

    I do plan to have PHP code running on my home page, if that makes a difference...

    Thanks.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

    What is my "home page"? home.php or front-page.php?

    Neither. Both of those are template files - not pages.

    Try having a read of Theme_Development.

  3. ixwa
    Member
    Posted 12 months ago #

    I did and have been reading this all day, but thanks for posting the link.

    I have
    index.php
    home.php
    front-page.php

    And right now anything I preview appears to load with the home.php file, no matter what static front page setting I use, and even this doesn't appear to use the get_header(); and get_footer(); calls. Not sure what part I'm missing in how these templates are assembled...

  4. ixwa
    Member
    Posted 12 months ago #

    I had foolishly left an old index.html on the server, which is why everything was loading the same.

  5. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

    Rename home.php to home-old.php

  6. ixwa
    Member
    Posted 12 months ago #

    Thanks, had actually just figured it out. front-page.php is the default "homepage" if static is set--I just wasn't seeing this because the old index.html was mucking up the works!

    Thanks for your very prompt replies :)

  7. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

    home.php may also cause problems if you leave it there.

  8. ixwa
    Member
    Posted 12 months ago #

    Really? So unless I plan to have a page somewhere that lists posts (all of them or just certain ones? not sure how this works) I should get rid of home.php altogether?

    In what circumstance would I want to hold onto it?

    Thanks again for your on-point help!

  9. esmi
    Theme Diva & Forum Moderator
    Posted 12 months ago #

    I should get rid of home.php altogether?

    Yes. You only need front-page.php and index.php

    In what circumstance would I want to hold onto it?

    If you were using a old version of WordPress that didn't recognise front-page.php.

  10. ixwa
    Member
    Posted 12 months ago #

    OK, thanks very much.

Reply

You must log in to post.

About this Topic