Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a custom post type with a WPAlchemy admin meta box class including multiple textareas with TinyMCE editors(for adding content to the custom post template). I've gotten the editors to display and function fine, however there is an awkward div at the bottom left of each textarea with "path" and a colon ":"

It would be great if someone knows how to remove what I'm guessing is meta information for the editor (word count ect..) but it doesn't seem to be functioning correctly on save.

Here's what I get when I inspect the element:

<div id="temp_options_desc-3_path_row" role="group" aria-labelledby="temp_options_desc-3_path_voice" tabindex="-1">
  <span id="temp_options_desc-3_path_voice">Path</span>
  <span>: </span><span id="temp_options_desc-3_path"></span>
</div>

Also the textarea and TinyMCE javascript function for displaying WYSIWYG editor:

functions.php:

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('mceAddControl', false, id);

            });
        });
    /* ]]> */</script><?php
}

WPAlchemy metabox class textarea:

<textarea cols="20" rows="20" class="temp_options_desc" name="<?php $mb->the_name(); ?>"><?php $mb->the_value(); ?></textarea>

Thanks!

share|improve this question
    
I'm pretty sure that when I did repeating, drag/dropable text editors for WP Alchemy I used CSS to tweak the style of the editors. TinyMCE just makes them a bit weird. –  helgatheviking Jul 26 '13 at 1:04
add comment

1 Answer

Possibly a simpler way to handle this problem is just use the new wp_editor function (introduced in 3.3). The main drawback is described in the function description:

... you cannot put it in meta-boxes that can be dragged and placed elsewhere on the page.

Technically, you can, it's just not going to play nice if someone's trying to drag-n-drop it around.

This is the way I do it:

<?php $mb->the_field('example'); 
    wp_editor(
        html_entity_decode($metabox->get_the_value()),
        $mb->get_the_name(),
        $settings = array('textarea_name' => $mb->get_the_name() ) 
        );
?>

The function description lists a bunch of the settings you can change (media buttons, teeny editor, size, what buttons appear, etc).

The function description also says something about ONLY LOWERCASE LETTERS IN THE ID ASLKDF JALKS JQ L!!! L!KJ!L NO REALLY WE MEAN IT.

The function handles (_) underscores and [] brackets fine, just don't mess with uppercase letters or (-) dashes.

share|improve this answer
    
thanks guiniveretoo, I'll be using this instead. I'm still getting the black path:p though, any thoughts? –  dcd018 Sep 5 '12 at 1:56
    
No, sorry, I don't have any clue where that could be coming from. Maybe revise your post with more information about that particular problem? Where in the code does that "path:" appear? What's the context? If you do a text search inside your project folder for keywords can you find it? –  guiniveretoo Sep 5 '12 at 21:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.