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.

Ive picked up an old plugin and am needing to enhance it for my clients specific needs.

In the admin section there is a text area used to add info about a download (essentially a custom post type). However the description field is a simple text area, and so only text is stored. The client need to be able to use this in a similar fashion to the post or blog editor elsewhere in WP. Primarily it needs to add new lines and formatting without the need to manually add html.

So, from my limited knowledge of WP I'm assuming that the way forward is to some how tell WP to make this utilise the TinyMCE...

Here is the function used to create the in the relevant admin page;

    public function display_sdm_description_meta_box($post) {  // Description metabox
    _e('Add a description for this download item.', 'sdm_lang');
    echo '<br /><br />';

    $old_description = get_post_meta($post->ID, 'sdm_description', true);
    ?>
    <textarea id="sdm_description" name="sdm_description" style="width:60%;height:100px;"><?php echo $old_description; ?></textarea>
    <?php
    wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');
}

If someone could show me how to adapt this code to get the required result, I'd be really grateful.

Thanks in advance!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You need to use wp_editor()

$old_description = get_post_meta($post->ID, 'sdm_description', true); 
$editor_id = 'sdm_description';
$settings = array( 'media_buttons' => false );

wp_editor( $old_description , $editor_id, $settings );
share|improve this answer
    
Thanks @helgatheviking !!!! –  Phill Healey Aug 14 at 11:30
    
Ive got a related issue now. Please take a look at the following link. Hopefully you can help me out. Thanks! wordpress.stackexchange.com/questions/157823/… –  Phill Healey Aug 14 at 12:07

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.