Make WordPress Core

Ticket #33625: edit_template_link_meta.diff

File edit_template_link_meta.diff, 1.1 KB (added by sgrant, 9 years ago)

Adds an Edit link for templates in the page editor

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

     
    788788        } // end hierarchical check.
    789789        if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
    790790                $template = !empty($post->page_template) ? $post->page_template : false;
     791
     792                $theme_directory = basename( get_template_directory_uri() );
     793                $template_file = basename( get_page_template() );
     794
     795                $url = get_admin_url( null, 'theme-editor.php' );
     796                $url = add_query_arg( 'theme', $theme_directory, $url );
     797                $url = add_query_arg( 'file', $template_file, $url );
     798
    791799                ?>
    792 <p><strong><?php _e('Template') ?></strong></p>
     800<p><strong><?php _e('Template') ?></strong> <a href="<?php echo esc_url( $url ); ?>"><?php _e( 'Edit' )?></a></p>
    793801<label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
    794802<?php
    795803/**