For a current project I am trying to echo a line of text saved in the theme's options page. I use the wp_editor function for the user input instead of a textarea. The code I am using is quite simple:
<?php
break;
case "wysiwyg" :
?>
<tr valign="top">
<th scope="row"><?php echo $value['name']; ?>:</th>
<td>
<?php
if( get_settings($value['id']) != "") {
$settings = stripslashes(get_settings($value['id']));
}else{
$settings = $value['std'];
}
?>
<?php wp_editor($settings,$value['id'],array('wpautop' => true,'media_buttons'=>false)); ?>
<br /><?php echo $value['desc']; ?>
</td>
</tr>
<?php break;
?>
I tried to make sure paragraphs are used by adding wpautop => true
..
The problem occurs when I try to add a single line of text in the WYSIWYG-mode. When saving the field, paragraph's arent added. After reloading the page the html view is changed back to WYSIWYG and all my HTML tags have disappeared.
I tried to use the wpautop
function manually, but this would append a blank paragraph after the insert variable. My code looks like this:
<?php echo wpautop(stripslashes($lo_homepage_highlight_1_text)) ;?>
And will return:
<p>Lorem ipsum (.....) dolor sit amet. Great rich text</p>
<p></p>
I don't understand what I am missing here.
\n
to<p>
basically...which can be pretty inconvenient at times.