Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #27119

    Hi, and thanks for this great theme!

    When using text box and editing text it ads more and more line breaks <p>&nbsp;</p> on several places (or

    <ul> in lists) each time I save it. How to avoid this?

    I found this post, but there is no public answer:

    Thanks for help


    Do you use the “Visual” mode or the “html” mode of the tinymce editor? I’d suggest to switch to the html mode – it gives you more control over the output and allows you to remove unnecessary line breaks etc.


    I use the html mode to delete the line breaks. But I have to do this every time I update a text because the line breaks are filled in automatically on opening. If I open the text box three times, there are three line breaks added on several places. It get’s worse with lists, because there are line breaks and ul added between every line.

    Isn’t there a way to just stop these auto line breaks? I tried “PS Disable Auto Formatting” plugin, but doesn’t help here (though helpful in other cases).


    You can remove the wpautop filter from the textblock elements. Open up wp-contentthemesenfoldconfig-templatebuilderavia-shortcodestextblock.php and replace

    return "<div class='avia_textblock {$custom_class}'>".ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content) )."</div>";


    return "<div class='avia_textblock {$custom_class}'>".ShortcodeHelper::avia_remove_autop($content,true)."</div>";


    $params['innerHtml'] = "<div class='avia_textblock avia_textblock_style' data-update_with='content'>".stripslashes(wpautop(trim(html_entity_decode( $params['content']) )))."</div>";


    $params['innerHtml'] = "<div class='avia_textblock avia_textblock_style' data-update_with='content'>".stripslashes(trim(html_entity_decode( $params['content']) ))."</div>";

    Then wp shouldn’t convert any line breaks to paragraphs, etc. anymore.


    Tried your code, but no effect.

    Here a screenshot what a simple list looks like after two times opening and saving:

    There must be something wrong, I can’t imagine that the text block was supposed to work like that.



    Dude’s code should work. Edit textblock.php again, remove everything then replace it with this:

    Please remove browser cache then reload the page again. Can you post the code that you’re trying to add on the text block?




    Thanks Ismael and Dude,

    the code works now.

    The text I was trying to add was a simple list:

    <li>List item 1</li>
    <li>List item 2</li>
    <li>List item 3</li>
    <li>List item 4</li>

    On every saving there where extra line breaks added by the text box as shown above.

    Now with your new code it works fine and remains unchainged. I copied textblock.php with your new code together with the folder structure into enfold-child theme and it works fine.

    Thanks again,




    Glad it is fixed now. :)



Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘How to avoid rendering extra line breaks?’ is closed to new replies.