Support » Plugins » Hacks » Help debugging a wierd line break issue

  • Resolved Ronak Gandhi



    I have a plugin that generates a Flickr Gallery.

    One of my users reported that he is getting all sorts of code on the gallery page instead of photos. Here is the page –

    I noticed that there is a
    tag at places where I have line continuation in the code.

    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″

    style=”text-align:center”>Photo Title</font>

    Can you help me identify the problem here? No other user has reported any such issue so far.

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"
    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 ‘Help debugging a wierd line break issue’ is closed to new replies.