Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#18018 closed defect (bug) (fixed)

body_class page-template-default removed

Reported by: peterwilsoncc's profile peterwilsoncc Owned by: nacin's profile nacin
Milestone: 3.2.1 Priority: normal
Severity: normal Version: 3.2
Component: Template Keywords: has-patch
Focuses: Cc:

Description

Changes to is_page_template() have inadvertently removed the body classes page-template and page-template-default from pages using the default template.

The class first appeared as a bug a few versions ago ( #17458 ) but has is now expected by theme authors.

Previous output

<body class="page page-id-2 page-template page-template-default [...]


3.2 output

<body class="page page-id-2 [...]

I have attached two .diff files:

  1. outputs .page-template-default only for default page templates
  2. outputs .page-template and .page-template-default for default page templates (previous behaviour)

I'm inclined to go with version (a) as (b) has .page-template doubling up for .page but it may affect existing themes.

Cheers,
Pete

Attachments (2)

18018-A.diff (750 bytes) - added by peterwilsoncc 14 years ago.
return page-template-default
18018-B.diff (919 bytes) - added by peterwilsoncc 14 years ago.
return page-template-default and page-template

Download all attachments as: .zip

Change History (10)

@peterwilsoncc
14 years ago

return page-template-default

@peterwilsoncc
14 years ago

return page-template-default and page-template

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to 3.2.1

18018-B makes more sense, even if it isn't technically compatible.

#2 @nacin
14 years ago

Sorry, I meant A.

When did this behavior begin originally?

#3 @peterwilsoncc
14 years ago

Based on Dion's comment in the support forum, I think it was around version 2.8. Unable to find a specific diff file or ticket # though, sorry.

Looks like it was when _wp_page_template was first set to default for pages without an actual template.

#4 @dd32
14 years ago

Looks like it was when _wp_page_template was first set to default for pages without an actual template.

Yes, That's when it would've been. I'm not sure where that change was made, it's 2.9~3.1 somewhere, I'll track that down later

Personally i'm of the opinion that the page-template-default class should have never been used (nor was it ever supposed to)

#5 @dd32
14 years ago

2.8.0 (body_class() introduced): <body class="page page-id-2 page-template- logged-in">

2.8.1: <body class="page page-id-2 logged-in">

2.9 (branch): <body class="page page-id-2 logged-in">

3.0 (branch): <body class="page page-id-2 page-template page-template-default logged-in">

3.1 (branch): <body class="page page-id-2 page-template page-template-default logged-in admin-bar">

3.2 (branch): <body class="page page-id-2 logged-in admin-bar singular two-column right-sidebar">

so it's 3.0 and 3.1 which "incorrectly" gained these classes.

#6 @peterwilsoncc
14 years ago

Thanks Dion, much appreciated.

I tend to agree, it probably shouldn't have appeared in the first place but now that it's been there for two complete versions it's become a surprise feature & isn't particularly buggy. It's why I made up option A - .page-template doubling up with .page is a clear case bug.

#7 @nacin
14 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [18412]:

Restore page-template-default body class. props peterwilsoncc, fixes #18018 for trunk.

#8 @nacin
14 years ago

In [18413]:

Restore page-template-default body class. props peterwilsoncc, fixes #18018 for 3.2.

Note: See TracTickets for help on using tickets.