WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Help debugging a wierd line break issue

[Resolved] Help debugging a wierd line break issue

Viewing 4 replies - 1 through 4 (of 4 total)
  • For example if my PHP code is –

    $disp_gallery .= "<font size=\"3\"
    style=\"text-align:center\">Photo Title</font>"

    The code generated is –

    <font size="3"
    <br>
    style="text-align:center">Photo Title</font>

    I had similar issues with a <br> tag being added to the first line in a form I was trying dynamically generate using PHP.

    The solution I found was to edit the default-filters.php file in the wp-includes folder.

    There are several lines of code that look like this:
    add_filter( 'the_content', 'wpautop'

    My issue was resolved when I commented out the line under

    // Display filters
    ...
    //add_filter( 'the_content', 'wpautop'            );

    Hope this helps.

    You’re user may have a plugin/theme that manipulates wpautop or unautop or something similar (assuming you are using shortcode_unautop() )

    The easier solution is to take out the line-break from your string. That’d completely avoid the line-break character getting converted into a

    Change the code to:

    $disp_gallery .= '<font size="3"'
     . 'style="text-align:center">Photo Title</font>'

    which is how code formatting is done without introducing unwanted line-breaks.

    Can’t think of a reason you’d want to keep the line-break in the string.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Help debugging a wierd line break issue’ is closed to new replies.