• When I post using HTML code, WP often inserts line breaks where a new line of code starts. I usually just cut and paste the HTML from FrontPage, so I have little control over the line-by-line code, lest I go in and make the entire code one line. It’s cool to have auto line breaks (that is, you hit enter, you get a new line) if you’re typing plain text into WP, but a pain when working with HTML
    My question: Is there a way to turn off auto line breaks?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Admin > Options > Writing
    "WordPress should correct invalidly nested XHTML automatically"
    Turn that off and see if it helps.

    Thread Starter Anonymous

    It was already turned off. No luck there.

    You can hack the files.
    in wp-include/template-functions-post.php line 11 reads:
    add_filter('the_content', 'wpautop');
    Just comment that line out
    // add_filter('the_content', 'wpautop');
    and it should stop doing most of the line wrapping functions.

    mahalie

    (@mahalie)

    Hmm…things have changed. I’m using 1.5 and opened wp-include/template-functions-post.php and couldn’t find the add_filter function on line 11 or anywhere else in the file. Anyone figure this out (for 1.5)?

    rgkeir

    (@rgkeir)

    It drove me crazy trying to get rid of the auto inserted <br /> code. But I found it —

    in functions-formatting.php on (or around) line 56

    function wpautop($pee, $br = 0) – deafault seems to be
    $br=1 which inserts the breaks automatically. I changed it to
    0 and now my javascript works fine – no more auto breaks.

    Further down in the code, it says it’s an option but there doesn’t
    seem to be a place, except in the code itself, to disable it.

    What a relief.

    Has this option been exposed somewhere else since then or do I still need to hack the code?

    Actually, with FrontPage you CAN have a lot of control over the HTML generated. After creating your post, simply click on the “HTML” tab at the bottom of the editing area and you will see the HTML generated.

    The best solution is to do away with editing in FrontPage as it throws in a lot of unnecessary junk into the HTML. If you want to use an offline editor I’d suggest wbloggar or Zempt. Both are easy to use and easy to install. Of course, I’ve never had a problem with WP’s built-in web-based interface. There’s even a WYSIWYG plugin to make it more word-processor-like.

    Thank you to rgkeir, the function-formatting.php worked perfect for me after many frustrating attempts to fix the </br> problem.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Line breaks in HTML’ is closed to new replies.