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. git-svn-id: https://develop.svn.wordpress.org/trunk@28837 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7e9cf1d2c0
commit
95f3506532
@ -488,7 +488,7 @@ if ( post_type_supports($post_type, 'editor') ) {
|
|||||||
<?php wp_editor( $post->post_content, 'content', array(
|
<?php wp_editor( $post->post_content, 'content', array(
|
||||||
'dfw' => true,
|
'dfw' => true,
|
||||||
'drag_drop_upload' => true,
|
'drag_drop_upload' => true,
|
||||||
'tabfocus_elements' => 'insert-media-button,save-post',
|
'tabfocus_elements' => 'insert-media-button-1,save-post',
|
||||||
'editor_height' => 360,
|
'editor_height' => 360,
|
||||||
'tinymce' => array(
|
'tinymce' => array(
|
||||||
'resize' => false,
|
'resize' => false,
|
||||||
|
@ -514,6 +514,9 @@ document.body.className = document.body.className.replace('no-js', 'js');
|
|||||||
* @param string $editor_id
|
* @param string $editor_id
|
||||||
*/
|
*/
|
||||||
function media_buttons($editor_id = 'content') {
|
function media_buttons($editor_id = 'content') {
|
||||||
|
static $instance = 0;
|
||||||
|
$instance++;
|
||||||
|
|
||||||
$post = get_post();
|
$post = get_post();
|
||||||
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
|
if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
|
||||||
$post = $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> ';
|
$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.
|
* Filter the legacy (pre-3.5.0) media buttons.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user