1

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" );' )
);
2
  • 2
    Post your code please, working or not.
    – s_ha_dum
    May 13, 2013 at 15:16
  • Hi s_ha_dum! Thank you for your response. Edited with the code.
    – Luismin
    May 14, 2013 at 6:36

1 Answer 1

2

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' => ''

    )

));
3
  • Thanks for the response. The editor appears but not the content from the textarea. Where does this code go?
    – Luismin
    May 14, 2013 at 7:42
  • $value should be your content from database table or any other source.
    – Core
    May 14, 2013 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, 2013 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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