Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#37599 closed enhancement (fixed)

Editor (WP_Editor or TinyMCE) page template body class

Reported by: webmandesign Owned by: azaozz
Priority: normal Milestone: 4.7
Component: TinyMCE Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

Hi,

Currently the post editor (TinyMCE) applies several classes on the editor's HTML body#tinymce:

  • Post type class
  • Post status class
  • If supported, post format class

However, it would be good idea to support a page template classes here too.

Usecase:

Theme author may target different content widths within editor stylesheet depending on the page template set. Such as for fullwidth page template or page with sidebar template.

Thanks for consideration!

Regards,

Oliver

Attachments (1)

37599.patch (2.2 KB ) - added by webmandesign 10 years ago.
Adding a page template CSS class on TinyMCE body

Download all attachments as: .zip

Change History (8)

#1 follow-up: @azaozz
10 years ago

  • Focuses ui template removed
  • Milestone Awaiting ReviewFuture Release
  • Version 4.5.3

Assuming that class will have to change "dynamically" when selecting another template from the drop-down, the same way post type classes work. This is fairly easy to do from a plugin or theme, but maybe it should happen by default.

Last edited 10 years ago by azaozz (previous) (diff)

#2 in reply to: ↑ 1 @webmandesign
10 years ago

Replying to azaozz:

Assuming that class will have to change "dynamically" when selecting another template from the drop-down, the same way post type classes work. This is fairly easy to do from a plugin or theme, but maybe it should happen by default.

Hi. Yes, I am doing this in the theme already (just not applying all the page template related classes as there is too many of them ;)) but I really think this should be part of the core.

@webmandesign
10 years ago

Adding a page template CSS class on TinyMCE body

#3 @webmandesign
10 years ago

  • Keywords has-patch added

I've made a patch for this. And judging by how the WordPress creates additional page template classes when applying them on HTML body on front-end, I think using simple page-template-{filename} class would be enough. Let me know if this is OK with you, guys.

#4 @azaozz
10 years ago

  • Milestone Future Release4.7

#5 @azaozz
10 years ago

  • Owner set to azaozz
  • Resolutionfixed
  • Status newclosed

In 38803:

TinyMCE:

  • When editing pages, add body class with the page template, or page-template-default.
  • Change the page template class when the users select another template, similarly to changing the post type class for posts.

Props webmandesign.
Fixes #37599.

#6 @webmandesign
10 years ago

Thanks for including this in WP4.7!

#7 @ocean90
10 years ago

Follow-up: #39368 (.page-template-default body class in editor doesn't appear in initial post/page load)

Note: See TracTickets for help on using tickets.