admin管理员组文章数量:1307787
User fills their user bio using Formidable forms.
It saves correctly and displays with line breaks in Worpdress admin on the user overview page.
It displays without line breaks on the site.
The only solution I found is to disable HTML sanitization and manually edit each profile and add <p>
or <br>
tags which is not an ideal solution. This is not ideal as it enables all HTML plus the need for manual edits of each profile.
What I would like is to display the line breaks as they were originally entered and saved in Wordpress. This would allow a simple workflow for users to add and update their profile without using HTML code.
Thanks.
User fills their user bio using Formidable forms.
It saves correctly and displays with line breaks in Worpdress admin on the user overview page.
It displays without line breaks on the site.
The only solution I found is to disable HTML sanitization and manually edit each profile and add <p>
or <br>
tags which is not an ideal solution. This is not ideal as it enables all HTML plus the need for manual edits of each profile.
What I would like is to display the line breaks as they were originally entered and saved in Wordpress. This would allow a simple workflow for users to add and update their profile without using HTML code.
Thanks.
Share Improve this question edited Jul 16, 2020 at 14:35 Jacob Peattie 44.1k10 gold badges50 silver badges64 bronze badges asked Jul 15, 2020 at 19:21 Adrian NutiuAdrian Nutiu 11 bronze badge 2- How are you currently displaying the bio on the site? – Jacob Peattie Commented Jul 16, 2020 at 14:35
- @JacobPeattie in 2 ways: Elementor author profile widget and the theme author bio box. Also happy to use Advanced Custom Fields if that would make it easier. – Adrian Nutiu Commented Jul 16, 2020 at 19:26
2 Answers
Reset to default 1You could use "white-space: pre;" in CSS to display newlines as they are
You can use the nl2br PHP function. It means insert line breaks where newlines (\n) occur in the string. https://www.w3schools/php/func_string_nl2br.asp
example:
echo nl2br($userbio);
Hope this helps.
本文标签: Display the line breaks in user bio without using html
版权声明:本文标题:Display the line breaks in user bio without using html 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741837940a2400328.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论