Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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:

    http://www.kriesi.at/support/topic/text-box-white-space

    Thanks for help

    #132860

    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.

    #132861

    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).

    #132862

    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>";

    with

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

    and

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

    with

    $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.

    #132863

    Tried your code, but no effect.

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

    https://www.dropbox.com/s/67ws8g1fl1fgnj9/line-break-screeshot.png

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

    #132864

    Hi,

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

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

    Regards,

    Ismael

    #132865

    Thanks Ismael and Dude,

    the code works now.

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

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

    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,

    Wolfgang

    #132866

    Hey,

    Glad it is fixed now. :)

    Cheers,

    Ismael

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

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