wordpress - TinyMCE editors in meta boxes, not saving P tag -
for hell autop function seems give me when don't want it, have several custom meta boxes tinymce textareas. , aren't saving
tags.. seem ok w/ saving other html markup.
my html 1 of boxes looks like:
<div class="customeditor"> <div class="custom_upload_buttons" class="hide-if-no-js"><?php do_action( 'media_buttons' ); ?></div> <?php $mb->the_field('below_content'); ?> <textarea rows="10" cols="50" name="<?php $mb->the_name(); ?>" rows="3"><?php $mb->the_value(); ?></textarea> </div>
the naming , stuff handled wpalchemy, hence weird $mb->the_name() stuff
function my_admin_print_footer_scripts() { ?>
/*
/* * multiple tinymce settings */
settings = { mode:"specific_textareas", width:"100%", theme:"advanced", skin:"wp_theme", theme_advanced_buttons1:"bold,italic,strikethrough,underline,|,bullist,numlist,blockquote,|,justifyleft,justifycenter,justifyright,|,link,unlink,|,spellchecker", theme_advanced_buttons2:"formatselect,xxxforecolor,|,pastetext,pasteword,removeformat,|,outdent,indent,|,undo,redo,|,code", theme_advanced_buttons3:"", theme_advanced_buttons4:"", language:"en", spellchecker_languages:"+english=en,danish=da,dutch=nl,finnish=fi,french=fr,german=de,italian=it,polish=pl,portuguese=pt,spanish=es,swedish=sv", theme_advanced_toolbar_location:"top", theme_advanced_toolbar_align:"left", theme_advanced_statusbar_location:"bottom", theme_advanced_resizing:"1", theme_advanced_resize_horizontal:"", dialog_type:"modal", relative_urls:"", remove_script_host:"", convert_urls:"", apply_source_formatting:"", remove_linebreaks:"1", gecko_spellcheck:"1", entities:"38,amp,60,lt,62,gt", accessibility_focus:"1", tabfocus_elements:"major-publishing-actions", media_strict:"", paste_remove_styles:"1", paste_remove_spans:"1", paste_strip_class_attributes:"all", wpeditimage_disable_captions:"", plugins:"safari,inlinepopups,spellchecker,paste,wordpress,tabfocus" };jquery(document).ready(function($) { var $ta, id, mceid; $('.customeditor textarea').each(function(i){ $ta = $(this); id = $ta.attr('id'); if (!id){ id = 'customeditor-' + i; $ta.attr('id',id); } tinymce.settings = settings; tinymce.execcommand('mceaddcontrol',
false, id); });
$('.custom_upload_buttons a').each(function() { $(this).click(function() { mceid = $(this).parent().next('textarea').attr('id'); window.send_to_editor = window.send_to_editor_clone; }); window.send_to_editor_clone = function(html){ tinymce.execinstancecommand(mceid, 'mceinsertcontent', false, html); tb_remove(); } }); }); /* ]]> */</script><?php }
// important: note priority of 99, js needs placed after tinymce loads add_action('admin_print_footer_scripts','my_admin_print_footer_scripts',99);
ok, guess know why editor content not saved. need call tinymce.triggersave();
write editor content html elements got created for. tinymce editor consists of iframe , moves content between html element , iframe.
Comments
Post a Comment