WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help debugging a wierd line break issue (5 posts)

  1. Ronak Gandhi
    Member
    Posted 3 years ago #

    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.

  2. Ronak Gandhi
    Member
    Posted 3 years ago #

    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>
  3. KristofferNord
    Member
    Posted 3 years ago #

    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.

  4. WraithKenny
    Member
    Posted 3 years ago #

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

  5. WraithKenny
    Member
    Posted 3 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic