WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#7715 closed defect (bug) (invalid)

With Static home page enabled, Posts page won't use a custom page template.

Reported by: miloandrew Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.6.1
Component: Template Keywords:
Focuses: Cc:

Description

I seem to have stumbled on a bug in WP 2.6.1.

When making a Page in WP, you can specify a page template to base it off of, as outlined http://codex.wordpress.org/Pages#Page_Templates.

If I make a page (lets call it Blog) and then specify a custom template for it say My_Blog_Template then browse to the page slug for the Blog, the custom template is viewed just fine.

BUT, if I go to the wp-admin/options-reading.php page and

  1. select that I would like a to use a static home page and then specify one (NOT Blog)
  2. and then specify the Blog page with the My_Blog_Template for the Posts page

The Blog page no loner picks up My_Blog_Template, but rather defaults to the normal template hierarchy.

What I'm trying to figure out is:

  • Was index.php designed to be used as the "latest posts" template? (therefore removing the need for my "blog" custom template? I don't think this is the case, as it is the fallback for ALL template hierarchy.

OR

  • Is there a bug where the Post page won't read a custom template as specified in the Manage Page admin screen? This is what I believe the situation is...

Change History (3)

comment:1 follow-up: Viper007Bond6 years ago

  • Milestone 2.7 deleted
  • Resolution set to invalid
  • Status changed from new to closed

When you pick a Page to be used to display the latest posts, only it's URL gets used. is_page() will return FALSE for example (also note it doesn't use the Page template).

home.php is the file you'll want to setup / edit.

http://codex.wordpress.org/Template_Hierarchy
http://codex.wordpress.org/Conditional_Tags

comment:2 in reply to: ↑ 1 miloandrew6 years ago

Thanks very much! Sorry to have logged a bug. No one responded on the forum.

I had actually looked at the pages that you quoted, but they didn't really help me to figure it out. You stating that home.php was the template to work with allowed me to find this page, which spells it out perfectly:

http://codex.wordpress.org/User:Ramiy/Conditional_Tags/is_home

-->

is_home

Wordpress 2.1 handles this function differently than prior versions - See static Front Page. If you select a static Page as your frontpage (see is_front_page()), the is_home() tag will be applied to your "posts page".

<--

Thanks again,
A

Replying to Viper007Bond:

When you pick a Page to be used to display the latest posts, only it's URL gets used. is_page() will return FALSE for example (also note it doesn't use the Page template).

home.php is the file you'll want to setup / edit.

http://codex.wordpress.org/Template_Hierarchy
http://codex.wordpress.org/Conditional_Tags

comment:3 Viper007Bond6 years ago

is_front_page() == http://yoursite.com/

is_home() == http://yoursite.com/latest-posts-page which is where the home.php template file is used:

Note: If you select a static Page as your frontpage (see below), this tag will be applied to your "posts page".

Note: See TracTickets for help on using tickets.