In `media_buttons()`, add a static var `$instance` to increment the `id` attribute of `insert-media-button-%d` on each call.

Props ericlewis.
Fixes #28090.

Built from https://develop.svn.wordpress.org/trunk@28837


git-svn-id: http://core.svn.wordpress.org/trunk@28641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-26 01:05:14 +00:00
parent 69b0077edf
commit 41ab39f42c
2 changed files with 10 additions and 3 deletions

View File

@ -488,7 +488,7 @@ if ( post_type_supports($post_type, 'editor') ) {
<?php wp_editor( $post->post_content, 'content', array(
'dfw' => true,
'drag_drop_upload' => true,
'tabfocus_elements' => 'insert-media-button,save-post',
'tabfocus_elements' => 'insert-media-button-1,save-post',
'editor_height' => 360,
'tinymce' => array(
'resize' => false,

View File

@ -514,6 +514,9 @@ document.body.className = document.body.className.replace('no-js', 'js');
* @param string $editor_id
*/
function media_buttons($editor_id = 'content') {
static $instance = 0;
$instance++;
$post = get_post();
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
$post = $GLOBALS['post_ID'];
@ -524,8 +527,12 @@ function media_buttons($editor_id = 'content') {
$img = '<span class="wp-media-buttons-icon"></span> ';
echo '<a href="#" id="insert-media-button" class="button insert-media add_media" data-editor="' . esc_attr( $editor_id ) . '" title="' . esc_attr__( 'Add Media' ) . '">' . $img . __( 'Add Media' ) . '</a>';
printf( '<a href="#" id="insert-media-button-%d" class="button insert-media add_media" data-editor="%s" title="%s">%s</a>',
$instance,
esc_attr( $editor_id ),
esc_attr__( 'Add Media' ),
$img . __( 'Add Media' )
);
/**
* Filter the legacy (pre-3.5.0) media buttons.
*