[theme-reviewers] Is Blog.php is allowed in theme?

Otto otto at ottodestruct.com
Sat Jul 5 17:20:46 UTC 2014


On Sat, Jul 5, 2014 at 12:03 PM, Philip M. Hofer (Frumph) <philip at frumph.net
> wrote:

>   Just tested to make sure as well.
>
> IF you use a home.php file AND set the settings –> reading,  posts page as
> one of your sub pages, it will STILL use both home.php on the index AND the
> posts page.  Again, not what is wanted.  So all of the ‘events’ that occur
> on the LANDING page are now duplicated on the page you set as the POSTS
> page.
>
> Again, not what is wanted; hence the use of the blog template is necessary.
>
> I have these three files:
>
> front-page.php
> home.php
> index.php
>
> It ALWAYS runs the home.php for both locations, also executing all events
> for is_home/front_page on both.
>
> front-page.php and index.php are not even looked at for either position.
>


No, this is incorrect. The hierarchy is very clear on this subject:

1. is_front_page() being true will cause the site to look
at front-page.php, if it exists.

2. Else, if is_home() is true, then it will look at home.php followed by
index.php.

The is_front_page() is true whenever the front page is displayed,
regardless of content.

The is_home() is true whenever the main blog posts page is being displayed,
no matter where it is. The main blog posts list is defined as "home".

Now, note that if you screw around with the main query, then you can make
things like is_home() return true when they shouldn't and such. All of the
template hierarchy presumes that the main query is being handled by
WordPress and not fiddled with by a plugin or some such thing. So yes,
whenever is_home() is true, then home.php will be loaded, but if you make
is_home() true via other means, then all bets are off.



As for the original question, there is no such template as "blog.php" and
it is not possible to make the main blog posts listing to display using a
Page Template. The main blog posts listing will always use one of
front-page.php, home.php, or index.php, depending on circumstances.

These circumstances are actually not difficult to figure out:

- The front-page.php is always used for the "Front Page", period, no matter
what it is.
- If there is no front-page.php, or the blog posts are not displayed on the
front-page (via Settings->Reading), then the home.php is always used for
the "Blog Posts", period, no matter where they are displayed.
- The index.php file is the fallback for all of these contexts.

There is no case where you would want to make a blog-posts-specific
template, because that is what home.php is specifically for. The "home" is
where the main blog posts listings display. I realize the terminology may
be confusing because of the blog-centric nature, but that is how it works.

-Otto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140705/1fbd6de0/attachment.html>


More information about the theme-reviewers mailing list