Tagged: Line Break, Text block
-
AuthorPosts
-
August 2, 2013 at 12:34 pm #27119
Hi, and thanks for this great theme!
When using text box and editing text it ads more and more line breaks
<p> </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:
https://kriesi.at/support/topic/text-box-white-space
Thanks for help
August 3, 2013 at 12:38 pm #132860Do 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.
August 3, 2013 at 1:27 pm #132861I 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).
August 3, 2013 at 1:50 pm #132862You 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.
August 3, 2013 at 4:06 pm #132863Tried 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.
August 5, 2013 at 12:41 am #132864Hi,
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
August 5, 2013 at 1:12 pm #132865Thanks 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
August 6, 2013 at 3:54 am #132866 -
AuthorPosts
- The topic ‘How to avoid rendering extra line breaks?’ is closed to new replies.