设置一个基本的WPAlchemy repeater字段,里面有一个TinyMCE文本框。如果重复,我无法选择新文本框并添加文本。
如果我删除TinyMCE,它可以正常工作。请帮忙。
功能。php:
// Tiny mce metaboxes
add_action(\'admin_print_footer_scripts\',\'admin_print_footer_scripts\',99);
function admin_print_footer_scripts()
{
?><script type="text/javascript">/* <![CDATA[ */
jQuery(function($)
{
var i=1;
$(\'.temp_options_desc\').each(function(e)
{
var id = $(this).attr(\'id\');
if (!id)
{
id = \'temp_options_desc-\' + i++;
$(this).attr(\'id\',id);
}
tinyMCE.execCommand( \'mceRemoveEditor\', false, id );
tinyMCE.execCommand( \'mceAddEditor\', false, id );
});
});
/* ]]> */</script><?php
}
metabox\\u模板。php:<div class="my_meta_control">
<?php global $wpalchemy_media_access; ?>
<h2>Awards</h2>
<?php while($mb->have_fields_and_multi(\'awards2\')): ?>
<?php $mb->the_group_open(); ?>
<h3>Award</h3>
<label>Awards Year:<br />
<?php $mb->the_field(\'award-year2\'); ?>
<input type="text" name="<?php $mb->the_name(); ?>" value="<?php $mb->the_value(); ?>" placeholder="2000" style="width:150px !important;" /></label>
<label>Award Content:<br />
<?php $mb->the_field(\'award-content2\'); ?>
<textarea style="width:100%;height: 50px;" class="temp_options_desc" name="<?php $mb->the_name(); ?>"><?php echo wp_richedit_pre($mb->get_the_value()); ?></textarea></label>
<a href="#" title="Remove" class="dodelete button"><strong>X</strong></a>
<?php $mb->the_group_close(); ?>
<?php endwhile; ?>
<p style="margin-bottom:15px; padding-top:5px;"><a style="margin:10px 10px 10px 0px;" href="#" class="dodelete-awards2 button">Remove All</a> <a href="#" style="margin:10px 10px 10px 0px;" class="docopy-awards2 button">Add Award</a></p>
<!-- REPEATER END -->
</div>