WordPress.org

Ready to get started?Download WordPress

Forums

home.php functionality faulty? (6 posts)

  1. sampablokuper
    Member
    Posted 5 years ago #

    Yesterday, I posted to a thread on this issue, but didn't receive any replies, presumably because the thread was marked as "resolved".

    In summary, the problems I see with not being able to use home.php to acheive a specific layout for the front page are:

    • This contradicts the stated template hierarchy. As we all know, when the docs and the code don't match, developers suffer. Well, I'd been suffering at least half an hour before I stumbled on that forum thread, because I read the docs and trusted them.
    • Using a file other than home.php for the "home" page is inelegant: it means that for no good reason, you have to call your home page something other than "home", or call your home page's template something other than home.php, or both… just because home.php's functionality is broken.

    There's already a bug filed about the issue, but I'm not convinced that the solution proposed is the best one. I'd like to gather some opinions, so please add your thoughts below.

    Also, for more background on the issue, you might want to read this blog post I wrote about it, which incorporates a log of an IRC chat I had on the subject.

  2. Austin Matzko
    Member
    Posted 5 years ago #

    Hello sampablokuper! Thanks for taking the time to bring up issues about WordPress that concern you. In general that's how problems get solved and WordPress improves for everyone. But in this case I disagree with your assessment.

    What this issue boils down to is that a while back WordPress developers had to decide on a term for the page where the most recent posts appear, which is not always the top-level page. The term they chose was "home." The term for the top-level page is "front."

    Perhaps there could have been better name choices, but those are the ones that they went with and we're stuck with. So the home.php template file is what is used on the "home" page, which is not necessarily the "front" page.

    You suggest that home.php should show on the "front" page when the "front" and "home" pages are different (when they're the same, it does). There are several reasons why this isn't the best idea:

    • "home" has a particular meaning in WordPress, a meaning that would be confused if it were used on the "front" page.
    • We would then lack a template name for the "home" page.
    • We already have a means of creating a custom template for the "front" page, thanks to page templates. So a "front-page.php" template would basically just be a limited version of a regular page template.

    This contradicts the stated template hierarchy. As we all know, when the docs and the code don't match, developers suffer. Well, I'd been suffering at least half an hour before I stumbled on that forum thread, because I read the docs and trusted them.

    The Codex is a wiki, meaning anybody can edit it. So sometimes there's stuff on there that's wrong, imprecise, or just outdated. On the positive side, the Codex is a wiki, meaning you can edit it and fix the problem for the rest of the community!

  3. sampablokuper
    Member
    Posted 5 years ago #

    What this issue boils down to is that a while back WordPress developers had to decide on a term for the page where the most recent posts appear, which is not always the top-level page. The term they chose was "home." The term for the top-level page is "front."

    The hysterical raisins argument is one I don't find massively compelling. I understand that issues like this occur, but a point release is a good time for dusting the cobwebs off confusing archaisms and getting rid of them. Alternatively, it's a good time for deciding to keep them and to document them reliably. Either would be better than the current situation, and would, IMO, have been more valuable to have done under the 2.7 milestone than the extra AJAX and whatnot in the admin panel. Ho hum.

    This said, I'm grateful for your clarification, which I hope makes it into the Codex.

    The Codex is a wiki, meaning anybody can edit it. So sometimes there's stuff on there that's wrong, imprecise, or just outdated.

    True, but it's disappointing that WP developers with commit access to the WordPress trunk don't always update the Codex to reflect the changes they've made. When the code is released, this ought to be done as a matter of course. If I'm not mistaken, the documentation of the behaviour of home.php hasn't been comprehensively brought up to date since 2.1 was released, or maybe earlier.

    On the positive side, the Codex is a wiki, meaning you can edit it and fix the problem for the rest of the community!

    I understand this, and have started to do so wrt. a couple of other issues I've noticed. But whereas a developer who's committed code to the WP trunk ought to know what that code is supposed to do, a user/developer like me has to try to infer this information from a mixture of docs (which may be out of date), bug reports (ditto) and code inspection, all of which is rather hit-and-miss by comparison with the insight of the code's author.

    I'm not saying there isn't a role the community can play in improving the docs, I'm just saying it's the WP core developers' responsibility to keep them up to date. The community can add value beyond that, by copy-editing, creating tutorials, etc.

    Okay, I've got that off my chest now :)

  4. Justin Tadlock
    Member
    Posted 5 years ago #

    The terms are a bit confusing to some, but I'd rather not add a front-page.php to the mix. The reason for this is that we can use page templates to dress up the front page. I think adding an extra template might just confuse matters more. I know of several people that use an actual front-page.php page template as well.

    I'll have to agree with filosofo's points above.

    I'm just saying it's the WP core developers' responsibility to keep them up to date.

    No, it's not really their responsibility. The Codex is a community-driven part of the site here. I'd rather have the core developers working on the code.

  5. raymondjplante
    Member
    Posted 5 years ago #

    WordPress has grown up way past the 'great blog' to become 'great CMS'. We should avoid 'wordpress particular' meanings for things. The rest of the world uses 'Home Page' to mean the main page of the site. home.php should be invoked whenever your 'front page' is hit, regardless of whether it's set to the latest posts or a specific page.

  6. WPITn2shape
    Member
    Posted 5 years ago #

    But this now means that the page must be static with no posts, right? What about 1 post from site news, or other reasons...

Topic Closed

This topic has been closed to new replies.

About this Topic