I've been working with a plugin making various tweaks and adding additional functionality.
It uses custom post type to create a page with an associated download. In the admin area which allows you to create these new downloads, there is a box which allows you to add/edit a description for the download. This serves as the body content for the rendered page.
However, the admin page only had a standard for this which was created by the following code;
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');
}
I needed this to give the typical WP editor functionality so that the end user can create the page / body content much the same as on a normal page or post. As a result I was given the following code via another question I posted here on SO.
$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 );
So I now have;
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);
//adds TinyMCE capabilities
$editor_id = 'sdm_description';
$settings = array( 'media_buttons' => false );
wp_editor( $old_description , $editor_id, $settings );
?>
<!--<textarea id="sdm_description" name="sdm_description" style="width:60%;height:500px;"><?php echo $old_description; ?></textarea>-->
<?php
wp_nonce_field('sdm_description_box_nonce', 'sdm_description_box_nonce_check');
}
This render the tinyMCE editor in the admin section. However, if I hit enter to add a new line to the content this is only rendered as
on the front end. Multiple 'enters' just result in more spaces, but never a new line or the equivalent of <br/>
Why isnt the content output as expected? How can it be fixed?
Thanks in advance!
--- EXTRA INFO
If i click the 'Tools' > 'Source' button on the TinyMCE editor I get a pop up windows showing the content I've created as being: <p>This is a test</p><p>Another line of testing!!!</p>
However on the front-end [eg the website] the source code shows as: `This is a test
Another line of testing!!!`
If I go into the DB, I can see that the data is stored literally like this:
This is a test
Another line of testing!!!