[wp-hackers] front-page.php always overrides home.php?

Chip Bennett chip at chipbennett.net
Sun Apr 24 17:20:12 UTC 2011


According to Yoast's WordPress XREF, "is_home()" is referenced all of 13
times in core:

Function and Method Cross
Referenceis_home()<http://xref.yoast.com/trunk/_functions/index.html#is_home>
*Defined at:*

   - /wp-includes/query.php<http://xref.yoast.com/trunk/wp-includes/query.php.html#is_home>
    -> line 426<http://xref.yoast.com/trunk/wp-includes/query.php.source.html#l426>
   - /wp-includes/query.php<http://xref.yoast.com/trunk/wp-includes/query.php.html#is_home>
    -> line 3250<http://xref.yoast.com/trunk/wp-includes/query.php.source.html#l3250>

*Referenced 13 times:*

   - /wp-includes/class-wp.php<http://xref.yoast.com/trunk/wp-includes/class-wp.php.html>
    -> line 471<http://xref.yoast.com/trunk/wp-includes/class-wp.php.source.html#l471>
   - /wp-includes/general-template.php<http://xref.yoast.com/trunk/wp-includes/general-template.php.html>
    -> line 541<http://xref.yoast.com/trunk/wp-includes/general-template.php.source.html#l541>
   - /wp-includes/query.php<http://xref.yoast.com/trunk/wp-includes/query.php.html>
    -> line 452<http://xref.yoast.com/trunk/wp-includes/query.php.source.html#l452>
   - /wp-includes/query.php<http://xref.yoast.com/trunk/wp-includes/query.php.html>
    -> line 3242<http://xref.yoast.com/trunk/wp-includes/query.php.source.html#l3242>
   - /wp-content/themes/twentyten/header.php<http://xref.yoast.com/trunk/wp-content/themes/twentyten/header.php.html>
    -> line 28<http://xref.yoast.com/trunk/wp-content/themes/twentyten/header.php.source.html#l28>
   - /wp-content/themes/twentyten/header.php<http://xref.yoast.com/trunk/wp-content/themes/twentyten/header.php.html>
    -> line 60<http://xref.yoast.com/trunk/wp-content/themes/twentyten/header.php.source.html#l60>
   - /wp-includes/canonical.php<http://xref.yoast.com/trunk/wp-includes/canonical.php.html>
    -> line 114<http://xref.yoast.com/trunk/wp-includes/canonical.php.source.html#l114>
   - /wp-content/themes/twentyeleven/header.php<http://xref.yoast.com/trunk/wp-content/themes/twentyeleven/header.php.html>
    -> line 29<http://xref.yoast.com/trunk/wp-content/themes/twentyeleven/header.php.source.html#l29>
   - /wp-includes/theme-compat/sidebar.php<http://xref.yoast.com/trunk/wp-includes/theme-compat/sidebar.php.html>
    -> line 66<http://xref.yoast.com/trunk/wp-includes/theme-compat/sidebar.php.source.html#l66>
   - /wp-content/themes/twentyeleven/functions.php<http://xref.yoast.com/trunk/wp-content/themes/twentyeleven/functions.php.html>
    -> line 240<http://xref.yoast.com/trunk/wp-content/themes/twentyeleven/functions.php.source.html#l240>
   - /wp-includes/post-template.php<http://xref.yoast.com/trunk/wp-includes/post-template.php.html>
    -> line 346<http://xref.yoast.com/trunk/wp-includes/post-template.php.source.html#l346>
   - /wp-includes/post-template.php<http://xref.yoast.com/trunk/wp-includes/post-template.php.html>
    -> line 411<http://xref.yoast.com/trunk/wp-includes/post-template.php.source.html#l411>
   - /wp-includes/template-loader.php<http://xref.yoast.com/trunk/wp-includes/template-loader.php.html>
    -> line 27<http://xref.yoast.com/trunk/wp-includes/template-loader.php.source.html#l27>


That seems like a reasonable number to be able to port to a more
semantically correct conditional function, without risking "breaking
everything in the world".

I don't know how such things are normally done, but I could foresee:

1) Defining "is_blog()" or "is_posts_index()" (or whatever) exactly as
"is_home()" is currently defined.
2) Re-defining "is_home()" as simply a wrapper for the above conditional.
3) Replacing "is_home()" with the new conditional in the above 13 references
4) Deprecating "is_home()" for some long duration

It seems feasible to me.

Chip

On Sun, Apr 24, 2011 at 11:53 AM, Otto <otto at ottodestruct.com> wrote:

> On Sun, Apr 24, 2011 at 8:05 AM, Jeremy Clarke <jer at simianuprising.com>
> wrote:
> > is_home should have been changed to is_posts or is_posts_index as soon as
> > front_page was added
>
> It's called backward compatibility. Home was redefined to mean the
> blog posts page of the site.
>
> Just because you don't like the naming system is not a good enough
> reason to just break everything willy-nilly.
>
>
> > That said I doubt you'd get much committer traction. The current
> situation
> > is seen as workable because WP is popular despite it, and there is little
> > love for purely semantic changes to core most of the time.
>
> This is true. It's simpler to document a minor naming weirdness than
> it is to *break everything else in the world*.
>
> As GLaDOS recently reminded us, the ideal solution to a problem is
> usually the easiest one.
>
> -Otto
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list