Make WordPress Core

Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#38983 closed defect (bug) (invalid)

page-{slug}.php not loaded when selected as static page

Reported by: bekui's profile bekui Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.7
Component: Bundled Theme Keywords:
Focuses: Cc:

Description

In WP 4.7 RC1 the page-{slug}.php is not loaded when selected as static page in Twenty Seventeen. If the page is in the menu, that link doesn't work either. Once latest posts is selected again, the link in the menu works fine.

Change History (12)

#1 @westonruter
8 years ago

@bekui is this only observed inside the customizer? Or is it also seen on the frontend after saving?

#2 follow-up: @westonruter
8 years ago

@bekui And is this when you've selected the static page for the page for posts or the page on front? If the page for posts, then it would be expected that page-{slug}.php would not load since it goes straight to use home.php. See https://developer.wordpress.org/themes/basics/template-hierarchy/#visual-overview

#3 in reply to: ↑ 2 @bekui
8 years ago

@westonruter I've selected the static front page. Inside the customizer everything works fine. It's when the front page is loaded, the text typed in the page is being displayed through page.php and not through page-{slug}.php. To me it looks like a twentyseventeen-glitch; it works as expected in other themes. If I can find the time, I will dive into it as well.

#4 @westonruter
8 years ago

  • Component changed from Customize to Bundled Theme

@davidakennedy is this a Twenty Seventeen problem?

#5 follow-up: @davidakennedy
8 years ago

  • Keywords reporter-feedback added

@bekui Thanks for the report! I'm having trouble understanding exactly what you're trying to do, so hang with me. :)

As @westonruter asked, are you trying to use the page-{slug}.php for the front page or posts page? Twenty Seventeen has a front-page.php so that's going to take precedence over everything else.

Writing out your exact steps would help here.

#6 @davidakennedy
8 years ago

  • Version changed from 4.6.1 to trunk

#7 in reply to: ↑ 5 @bekui
8 years ago

@davidakennedy, I think you do not have trouble to understand me. :-) I found the following: I'm aware of the front-page.php. Thanks to you, because I forgot. But: The front-page.php is also expected, accordig to the WordPress Page Hierarchy, to go through Page Shown On Front -> [Custom | Default] Template -> page-{slug}.php -> etc. And it doesn't. I understand front-page.php takes precedence, but I also think it should finish his job when 'Page Shown On Front' is selected. It's easy to work around, of course. But I think it's not correct.

Replying to davidakennedy:

@bekui Thanks for the report! I'm having trouble understanding exactly what you're trying to do, so hang with me. :)

As @westonruter asked, are you trying to use the page-{slug}.php for the front page or posts page? Twenty Seventeen has a front-page.php so that's going to take precedence over everything else.

Writing out your exact steps would help here.

#8 follow-up: @knutsp
8 years ago

  • Keywords close added

According to WordPress Template hierarchy https://developer.wordpress.org/files/2014/10/template-hierarchy.png:

When "Site Front Page", as selected in Settings, is requested by visting the front page (root), the primary template to use is front-page.php. Only when front-page.php does not exist, WordPress will check for a custom template and further. And when custom isn't the case (page using default template) then it will look for page-$slug.php,page-$id.php, page.php, singular.php, index.php, in that order.

So, if I understand you correctly, you are making a false assumption about that page-$slug.php will be checked for and used, in case the page in question is actually the "Site Front Page".

Last edited 8 years ago by knutsp (previous) (diff)

#9 in reply to: ↑ 8 @bekui
8 years ago

Correct. Because there is a line between 'Page Shown On Front' and 'Page Template', I expected that the same logic applies after skipping to 'Page Template'. As is the case when it comes from 'Static Page'. With the difference that the page-{slug}.php will be wrapped inside a front-page-whohoo. Which isn't, and I can see why.

So.. front-page.php is the new page-{slug}.php when in comes to the front page in Twenty Seventeen, I guess! I can live with that! Thanks for clarifying, and sorry for the bother..

Replying to knutsp:

According to WordPress Template hierarchy https://developer.wordpress.org/files/2014/10/template-hierarchy.png:

When "Site Front Page", as selected in Settings, is requested by visting the front page (root), the primary template to use is front-page.php. Only when front-page.php does not exist, WordPress will check for a custom template and further. And when custom isn't the case (page using default template) then it will look for page-$slug.php,page-$id.php, page.php, singular.php, index.php, in that order.

So, if I understand you correctly, you are making a false assumption about that page-$slug.php will be checked for and used, in case the page in question is actually the "Site Front Page".

#10 @knutsp
8 years ago

  • Keywords reporter-feedback close removed
  • Resolution set to invalid
  • Status changed from new to closed

#11 @davidakennedy
8 years ago

@bekui No need to apologize! This stuff can get complex sometimes. I really appreciate the report and you following up on my questions. And thanks to @knutsp for jumping in and helping!

#12 @swissspidy
8 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.