Forums

Where is the "\n" to "<br>" code for blog by email? (8 posts)

  1. djdaverich
    Member
    Posted 4 years ago #

    When sending an email via outlook in HTML, it sends tags in a pretty sloppy manner. One problem is that wordpress interprets a newline character as intentional, and adds a <br>, therefore breaking the tag if the tag is on 2 lines. Where is the code where it adds the <br>? Cant seem to find it. Seems like it would be easy to just add something in to handle this. Thanks in advance.

    Example:
    blah random whatever <span
    style=blah>text</span>

    Turns into:
    blah random whatever <span <br>
    style=blah>text</span>

  2. Otto
    Tech Ninja
    Posted 4 years ago #

    That is all added in post-processing, for the actual display of the post. The wpautop function handles most of it.

  3. djdaverich
    Member
    Posted 4 years ago #

    What page is that in?

  4. Otto
    Tech Ninja
    Posted 4 years ago #

    Why not search through it? Use an editor like TextPad and hit ctrl-f5 to text search through multiple files.

  5. djdaverich
    Member
    Posted 4 years ago #

    Cause I'd have to open all of the files, didnt know if someone just knew off the top of their heads.

  6. Otto
    Tech Ninja
    Posted 4 years ago #

    Why would you have to open all the files? Like I said, Textpad can search through multiple files. Without opening them.

    For that matter, Windows built in search is perfectly capable of finding text in a file in a directory, it's just really annoying to use.

    Get a good editing program that can search multiple files. You don't need to open them all one by one.

  7. Bobcat
    Member
    Posted 4 years ago #

    I'm planning on using the phone_content filter to strip the newlines from the email text.

  8. Bobcat
    Member
    Posted 4 years ago #

    You need to call add_filter for the hook phone_content. In your function that filters the message, you need to do the following:

    $new_content = str_replace(array("\r\n", "\r"), "\n", $content);
    $new_content = ereg_replace("([^\n])\n([^\n])", '\1 \2', $new_content);

    The first line handles the different forms of end-of-line markers. The second line converts all single newlines to spaces.

    Give it a try.

Topic Closed

This topic has been closed to new replies.

About this Topic