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 tabbed menu which has some input fields that works properly. I followed this tutorial: http://wp.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-8-validation-sanitisation-and-input-ii/

But, I need to replace the textarea input for the rich text element. I tried to use the function wp_editor() but I do not know how to pass the id from the textarea.

How can I add or manage de editor inside? I saw some tutorials but still with problems.

Thanks in advance

This is de Code:

This is the code.

Here. I create de field:

add_settings_field( 
'Textarea Element', 
__( 'Textarea a TinyMCE', 'mymenu' ),   
'textarea_element_callback',    
'theme_input_examples', 
'input _section'    
);

And here I made and echo to show it on my admin page:

function textarea_element_callback() {
$options = get_option( 'theme_input_examples' );
echo '<textarea id="textarea_example" name=" theme_input_examples[textarea_example]" rows="5" cols="40">' . $options['textarea_example'] . '</textarea>';
} 

This is the menu where I display the textarea:

add_submenu_page(
'theme_menu',
__( 'Opfolgning pa kontrakt', 'mymenu' ),
__( 'Opfolgning pa kontrakt', ' mymenu ' ),
'administrator',
'theme_input_examples',
create_function( null, 'theme_display( "input_examples_4" );' )
);
share|improve this question
2  
Post your code please, working or not. –  s_ha_dum May 13 '13 at 15:16
    
Hi s_ha_dum! Thank you for your response. Edited with the code. –  Luismin May 14 '13 at 6:36

1 Answer 1

up vote 1 down vote accepted

This is was I use to convert textarea with wp_editor()

wp_editor($value, "editor-name", array(

    'tinymce' => array(

        'theme_advanced_buttons1' => 'bold,italic,underline',

        'theme_advanced_buttons2' => '',

        'theme_advanced_buttons3' => ''

    )

));
share|improve this answer
    
Thanks for the response. The editor appears but not the content from the textarea. Where does this code go? –  Luismin May 14 '13 at 7:42
    
$value should be your content from database table or any other source. –  Core May 14 '13 at 7:44
    
Thanks!! I recover the $value properly but if I put before the textarea content. Is there any way to change this part of code and put here your code to send it in the form?WordPress Development Meta add_settings_field( 'Textarea Element', __( 'Textarea a TinyMCE', 'mymenu' ), 'textarea_element_callback', 'theme_input_examples', 'input_section' ); [/meta]Sorry, I'm not good in programming :S –  Luismin May 14 '13 at 8:27

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.