WordPress.org

Ready to get started?Download WordPress

Forums

Widget admin line breaks in HTML (3 posts)

  1. andybarnes
    Member
    Posted 5 years ago #

    Hi

    I have what seems to be a simple problem that I just cannot figure out...

    For example, if I add a text widget to my sidebar and enter text, hitting enter after certain lines, this does not equate to HTML
    line breaks, only carriage returns within the source code.

    Please can someone tell me how I can convert these returns to generate
    tags? I don't want to put HTML within the widget as a non-web developer will be editing the content.

    Do I need to do some sort of php replace function on the widget output? In the functions file?

    I'd really appreciate some help!

    Thanks

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 5 years ago #

    The Text widget doesn't do any "smart" formatting for you. Sorry. If you want HTML breaks, then you have to put them in there yourself.

    If you want a fancier text widget that can do that sort of thing, look for a plugin to add it. Like this one:
    http://wordpress.org/extend/plugins/wysiwyg-text-widget/

  3. andybarnes
    Member
    Posted 5 years ago #

    Thanks for the response Otto and for the linked widget.

    But is it at all possible for me to write a php filter to take any carriage returns and replace them with BR tags before outputting the content? I thought that's the kind of thing filters are for?

    Help much appreciated!

Topic Closed

This topic has been closed to new replies.

About this Topic