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

Chip Bennett chip at chipbennett.net
Sat Jul 5 18:59:20 UTC 2014


It's a pedantic, but meaningful, nomenclature issue. Your blog.php is a *custom
page template* file.

In the Template Hierarchy, a *template *file is hierarchy-defined,
contextual template file. Within that hierarchy is the static page context,
which uses the Page Template hierarchy. Within the Page Template hierarchy
is the *custom page template* file. I only say that to ensure that we're
all talking on the same page, because when I hear *template file*, I assume
the Template Hierarchy nomenclature. I assume Otto is thinking along the
same lines.

Anyway, whether it's called blog.php, page-blog.php, template-blog.php, or
whatever: your blog.php is a custom page template file, which, as both Otto
and I have pointed out, will never be used to display the blog posts index
when core settings are configured properly.


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

>   it’s a template that themes have that do the blog loop that can be
> associated to a page, either custom for specific categories are all
>
>  “there’s no way to display it using any other template file”
>
> This is what I use, works fine:
>
> <?php
> /*
> Template Name: Blog
> */
> get_header();
>
> $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
>
> $blog_query = array(
>         'paged' => $paged,
>         'post_type' => 'post',
>         'in_the_loop' => true,
>         'posts_per_page' => comicpress_themeinfo('home_post_count')
>         );
>
> $wp_query = new WP_Query(); $wp_query->query($blog_query);
> if (have_posts()) {
>     while (have_posts()) : the_post();
>         $withcomment = 0;
>         get_template_part('content', get_post_format());
>     endwhile;
>     comicpress_pagination();
> }
>
> wp_reset_query();
>
> get_footer();
>
>
>  *From:* Otto <otto at ottodestruct.com>
> *Sent:* Saturday, July 05, 2014 11:00 AM
> *To:* Discussion list for WordPress theme reviewers.
> <theme-reviewers at lists.wordpress.org>
> *Subject:* Re: [theme-reviewers] Is Blog.php is allowed in theme?
>
>   On Sat, Jul 5, 2014 at 12:48 PM, Philip M. Hofer (Frumph) <
> philip at frumph.net> wrote:
>
>>   The blog template is the point I was making in the first place, where
>> if you do *not* want the is_home or is_front_page events to execute, that
>> is the only way to bypass that; which makes having a blog.php useful.
>>
>>
>
> No, I mean, there is nothing in the code that I can find for "blog.php" at
> all. It's not mentioned in the Template Hierarchy, there's nothing in the
> template.php core file that mentions it. So, what exactly is this
> "blog.php" to which you refer?
>
> As far as I know, if you're displaying the results of the main posts
> query, then you're doing it on front-page.php, home.php, or index.php.
> There's no way to display it using any other template file.
>
> -Otto
>
>
> ------------------------------
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140705/e02f6499/attachment.html>


More information about the theme-reviewers mailing list