Changes between Initial Version and Version 1 of Ticket #57422
- Timestamp:
- 01/05/2023 02:32:28 PM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #57422
- Property Keywords changes-requested removed
-
Property
Component
changed from
General
toPosts, Post Types
-
Ticket #57422 – Description
initial v1 1 When is_singular() and is_page_template() and the template file is inside a directory within the theme folder, get_body_class()adds a class with a missing hyphen between the template directory and the template file name.1 When `is_singular()` and `is_page_template()` and the template file is inside a directory within the theme folder, `get_body_class()` adds a class with a missing hyphen between the template directory and the template file name. 2 2 3 post-template.phpline 677;3 `post-template.php` line 677; 4 4 5 $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) ); 5 `$classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( '.', '-', $template_slug ) );` 6 6 7 Example: post_type is page and template file is, "page-templates/my-template-file.php"7 Example: `post_type` is page and template file is, `page-templates/my-template-file.php` 8 8 9 Result: .page-template-page-templatesmy-template-file-php9 Result: `.page-template-page-templatesmy-template-file-php` 10 10 11 Suggested change to post-template.phpline 677;11 Suggested change to `post-template.php` line 677; 12 12 13 $classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', $template_slug ) ); 13 `$classes[] = "{$post_type}-template-" . sanitize_html_class( str_replace( array( '.', '/' ), '-', $template_slug ) );`