[wp-trac] [WordPress Trac] #57422: get_body_class() adding class "{$post_type}-template-{dir}{file}"

WordPress Trac noreply at wordpress.org
Thu Jan 5 21:11:15 UTC 2023


#57422: get_body_class() adding class "{$post_type}-template-{dir}{file}"
-------------------------------+------------------------------
 Reporter:  arrancurran        |       Owner:  (none)
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  6.1.1
 Severity:  minor              |  Resolution:
 Keywords:  close              |     Focuses:  css, template
-------------------------------+------------------------------
Changes (by SergeyBiryukov):

 * keywords:   => close


Comment:

 Hi there, welcome to WordPress Trac! Thanks for the report.

 Replying to [ticket:57422 arrancurran]:
 > Example: `post_type` is page and template file is, `page-templates/my-
 template-file.php`
 >
 > Result: `.page-template-page-templatesmy-template-file-php`

 This was previously discussed in #23470 and improved in [30100] in a way
 that is similar to the suggestion here.

 With the example above, a class like this [source:tags/6.1.1/src/wp-
 includes/post-template.php?marks=674-676#L668 should also be added]:

 `.page-template-page-templates-my-template-file`

 However, the consensus was that the old class needs to remain for backward
 compatibility and cannot be removed.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57422#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list