WordPress.org

Make WordPress Core

Ticket #21774: 21774.2.diff

File 21774.2.diff, 3.6 KB (added by MikeHansenMe, 5 years ago)

refresh

  • src/wp-admin/includes/meta-boxes.php

     
    705705 *
    706706 * @param object $post
    707707 */
    708 function page_attributes_meta_box($post) {
    709         $post_type_object = get_post_type_object($post->post_type);
     708function page_attributes_meta_box( $post ) {
     709        if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
     710                $template = ! empty( $post->page_template ) ? $post->page_template : false;
     711                ?>
     712<p><strong><?php _e( 'Template' ) ?></strong></p>
     713<label class="screen-reader-text" for="page_template"><?php _e( 'Page Template' ) ?></label><select name="page_template" id="page_template">
     714<?php
     715/**
     716 * Filter the title of the default page template displayed in the drop-down.
     717 *
     718 * @since 4.1.0
     719 *
     720 * @param string $label   The display value for the default page template title.
     721 * @param string $context Where the option label is displayed. Possible values
     722 *                        include 'meta-box' or 'quick-edit'.
     723 */
     724$default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
     725?>
     726<option value="default"><?php echo esc_html( $default_title ); ?></option>
     727<?php page_template_dropdown( $template ); ?>
     728</select>
     729<?php
     730        }
     731        $post_type_object = get_post_type_object( $post->post_type );
    710732        if ( $post_type_object->hierarchical ) {
    711733                $dropdown_args = array(
    712734                        'post_type'        => $post->post_type,
     
    713735                        'exclude_tree'     => $post->ID,
    714736                        'selected'         => $post->post_parent,
    715737                        'name'             => 'parent_id',
    716                         'show_option_none' => __('(no parent)'),
     738                        'show_option_none' => __( '(no parent)' ),
    717739                        'sort_column'      => 'menu_order, post_title',
    718740                        'echo'             => 0,
    719741                );
     
    732754                $pages = wp_dropdown_pages( $dropdown_args );
    733755                if ( ! empty($pages) ) {
    734756?>
    735 <p><strong><?php _e('Parent') ?></strong></p>
    736 <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
     757<p><strong><?php _e( 'Parent' ) ?></strong></p>
     758<label class="screen-reader-text" for="parent_id"><?php _e( 'Parent' ) ?></label>
    737759<?php echo $pages; ?>
    738760<?php
    739761                } // end empty pages check
    740762        } // end hierarchical check.
    741         if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
    742                 $template = !empty($post->page_template) ? $post->page_template : false;
    743                 ?>
    744 <p><strong><?php _e('Template') ?></strong></p>
    745 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
    746 <?php
    747 /**
    748  * Filter the title of the default page template displayed in the drop-down.
    749  *
    750  * @since 4.1.0
    751  *
    752  * @param string $label   The display value for the default page template title.
    753  * @param string $context Where the option label is displayed. Possible values
    754  *                        include 'meta-box' or 'quick-edit'.
    755  */
    756 $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
    757 ?>
    758 <option value="default"><?php echo esc_html( $default_title ); ?></option>
    759 <?php page_template_dropdown($template); ?>
    760 </select>
    761 <?php
    762         } ?>
     763        ?>
    763764<p><strong><?php _e('Order') ?></strong></p>
    764765<p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
    765766<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?>