Gallery Shortcode problems with multiple tinyMCE editors in 3.5
-
If you have a metabox with a richtext editor in it, inserted galleries get mixed up.
If I insert a gallery in the main editor, the edit and delete buttons won’t work.
If I insert a gallery in the metabox-editor, it all works as expected.If there is a gallery in the main-editor AND in the metabox-editor, a click on the edit-icon on the main-editor opens the gallery-modal with the settings of the gallery from the metabox-editor.
Steps to reproduce:
Insert this code into functions.php and then insert a gallery in the editor://call our hooks add_action('admin_init', 'yourplugin_metabox'); add_action('save_post', 'yourplugin_metabox_save'); //return the custom blurb function yourplugin_secondary_blurb($id = '') { $id = (empty($id)) ? get_the_ID() : intval($id); $custom = get_post_custom($id); return @$custom['secondary_blurb'][0]; } // add metabox to 'page' post type function yourplugin_metabox() { global $hys; if ( current_user_can('manage_options') ) add_meta_box( 'secondary_blurb_box_id', __('Secondary Blurb', 'yourplugin_sec_blurb' ), 'secondary_blurb_box', 'page' ); } //secondary blurb metabox HTML function secondary_blurb_box() { global $post; echo '<input type="hidden" name="yourplugin_noncename"'. ' id="yourplugin_noncename" value="' . wp_create_nonce( 'aunqiueyourpluginid' ) . '" /> <style type="text/css"> #ed_toolbar { display:none; } </style><div>'; the_editor(yourplugin_secondary_blurb(), "secondary_blurb"); echo "</div>"; } // save the secondary blurb value. verify and permission function yourplugin_metabox_save( $post_id ) { global $hys; if (!isset($_POST['yourplugin_noncename']) || !wp_verify_nonce( $_POST['yourplugin_noncename'], 'aunqiueyourpluginid' )) return $post_id; if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id; if ( 'page' == $_POST['post_type'] ) { if ( !current_user_can( 'edit_page', $post_id ) ) return $post_id; } //save the secondary blurb text if applic.. if (isset($_POST['secondary_blurb'])) { update_post_meta($post_id,'secondary_blurb',$_POST['secondary_blurb']) or add_post_meta($post_id,'secondary_blurb',$_POST['secondary_blurb']); } }
Same misbehaviour with meta-box plugins like Rilwis Metabox
NOTE:
This misbehaviour didn’t appear in 3.5 – Beta 3
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Gallery Shortcode problems with multiple tinyMCE editors in 3.5’ is closed to new replies.