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 am using TinyMCE Advanced plugin according to qTranslate in a wordpress 3.3 installation. My question is: why does tinymce translate visual editor new line ("enter" key) in a <p>&nbsp;</p> instead of <br/>?

Is it possible to change this behavior?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Go into Settings -> TinyMCE Advanced, and check the option Stop removing the <p> and <br /> tags when saving and show them in the HTML editor. This will allow you full control over those tags inside the HTML view.

For a single line break without overriding the editor, use Shift+Enter.

To override the editor and make Enter a single line break, put this into your functions.php:

function change_mce_options($init){
    $init["forced_root_block"] = false;
    $init["force_br_newlines"] = true;
    $init["force_p_newlines"] = false;
    $init["convert_newlines_to_brs"] = true;
    return $init;       
}
add_filter('tiny_mce_before_init','change_mce_options');

This does not convert shift+enter into <p></p> however, and this will cause some strange behavior for already existing content (if you're inside an existing <p> it will give two lines instead of one), so I would strongly recommend getting used to shift+enter instead.

share|improve this answer
    
i do not understand your answer. I already use tinymce advanced, but I can't find the options where I can choose to use <br/> instead of <p>&nbsp;</p> –  frabiacca Mar 8 '12 at 8:33
    
Edited comment to reflect. –  SickHippie Mar 8 '12 at 17:32

1) use soft returns (shift+enter) to insert <br> instead of paragraphs.
2) if you want to make intent in the beginning of sentence after
(SHIFT+ENTER), then you may need to use this custom code: http://wordpress.stackexchange.com/a/139347/42702

share|improve this answer

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.