Make WordPress Core


Ignore:
Timestamp:
10/17/2016 01:10:01 AM (8 years ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r38773 r38803  
    664664            if ( $post = get_post() ) {
    665665                $body_class .= ' post-type-' . sanitize_html_class( $post->post_type ) . ' post-status-' . sanitize_html_class( $post->post_status );
     666
    666667                if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
    667668                    $post_format = get_post_format( $post );
     
    670671                    else
    671672                        $body_class .= ' post-format-standard';
     673                }
     674
     675                if ( $page_template = get_page_template_slug( $post ) ) {
     676                    $page_template = str_replace( '.', '-', basename( $page_template, '.php' ) );
     677                    $body_class .= ' page-template-' . sanitize_html_class( $page_template );
    672678                }
    673679            }
Note: See TracChangeset for help on using the changeset viewer.