Make WordPress Core

Ticket #28090: 28090.2.diff

File 28090.2.diff, 1.5 KB (added by pento, 10 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    504504<?php wp_editor( $post->post_content, 'content', array(
    505505        'dfw' => true,
    506506        'drag_drop_upload' => true,
    507         'tabfocus_elements' => 'insert-media-button-1,save-post',
     507        'tabfocus_elements' => 'insert-media-button,save-post',
    508508        'editor_height' => 300,
    509509        'tinymce' => array(
    510510                'resize' => false,
  • src/wp-admin/includes/media.php

     
    516516 */
    517517function media_buttons($editor_id = 'content') {
    518518        static $instance = 0;
    519         $instance++;
    520519
    521520        $post = get_post();
    522521        if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
     
    528527
    529528        $img = '<span class="wp-media-buttons-icon"></span> ';
    530529
    531         printf( '<a href="#" id="insert-media-button-%d" class="button insert-media add_media" data-editor="%s" title="%s">%s</a>',
    532                 $instance,
     530        if ( $instance > 0 ) {
     531                $id = "insert-media-button-$instance";
     532        } else {
     533                $id = "insert-media-button";
     534        }
     535        $instance++;
     536
     537        printf( '<a href="#" id="%s" class="button insert-media add_media" data-editor="%s" title="%s">%s</a>',
     538                $id,
    533539                esc_attr( $editor_id ),
    534540                esc_attr__( 'Add Media' ),
    535541                $img . __( 'Add Media' )