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

  • Resolved Ronak Gandhi

    (@ronakg)


    Hi,

    I have a plugin that generates a Flickr Gallery. http://wordpress.org/extend/plugins/awesome-flickr-gallery-plugin/

    One of my users reported that he is getting all sorts of code on the gallery page instead of photos. Here is the page – http://www.harwichfoe.co.uk/gallery?afg_page_id=1

    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"
    <br>
    style="text-align:center">Photo Title</font>
    KristofferNord

    (@kristoffernord)

    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.

    [Inactive]

    (@wraithkenny)

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

    [Inactive]

    (@wraithkenny)

    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.