#18018 closed defect (bug) (fixed)
body_class page-template-default removed
Reported by: | peterwilsoncc | Owned by: | 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:
- outputs .page-template-default only for default page templates
- 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)
Change History (10)
#1
@
14 years ago
- Milestone changed from Awaiting Review to 3.2.1
18018-B makes more sense, even if it isn't technically compatible.
#3
@
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
@
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
@
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
@
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.
return page-template-default