• twlack

    (@twlack)


    This is the code on my page:

    <h3>John Smith</h3>
    <table><tr><td>[cfdb-html form="Contact form 1" show="your-name,your-email" filter="your-name=John Smith"]<tr><td>${your-name}</td><td>${your-email}</td></tr>[/cfdb-html]</td></tr></table>

    and this is the source code from Chrome when the above page is displayed:

    <h3>John Smith</h3>
    <table>
    <tr>
    <td><br />
    <tr>
    <td>John Smith</td>
    <td>twlack@anydomain.com</td>
    </tr>
    <p><br />
    <tr>
    <td>John Smith</td>
    <td>JohnSmith@anotherdomain.com</td>
    </tr>
    <p></td>
    </tr>
    </table>

    Why are the extra <p> <br /> being put in there and how can I get rid of them?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Michael Simpson

    (@msimpson)

    Most likely extra P & BR tags are being put there by WordPress. Flip your WP editor to HTML mode to edit the post/page and make sure there are no blank lines there…WP will inject tags for them.

    Thread Starter twlack

    (@twlack)

    I have the visual editor in WP set to “Hide” so “HTML” is not even an option when I add/edit pages.

    Also notice the code for the page I show above has only 1 return after the </h3> and when I take out that return the output does not change. But to be sure I did a new page with this:

    <h2>John Smith</h2><table>[cfdb-html form="Contact form 1" show="your-name,your-email" limit="10" orderby="Submitted desc" filter="your-name=John Smith"]<tr><td>${your-name}</td><td>${your-email}</td></tr>[/cfdb-html]</table>
    
    <h2>John Smith</h2><table><tr><td>your-name</td><td>your-email</td></tr></table>

    And this is the output:

    <h2>John Smith</h2>
    <table><br />
    <tr>
    <td>John Smith</td>
    <td>twlack@anydomain.com</td>
    </tr>
    <p><br />
    <tr>
    <td>John Smith</td>
    <td>twlack@another.com</td>
    </tr>
    <p></table>
    <h2>John Smith</h2>
    <table>
    <tr>
    <td>your-name</td>
    <td>your-email</td>
    </tr>
    </table>

    Notice on the second table, with the cfdb tags stripped, that the extra p’s and br’s are not inserted. It has got to be something with the cfdb, right?

    Plugin Author Michael Simpson

    (@msimpson)

    Ok, sounds like the shortcode is adding a blank line at the end and WordPress is deciding to inject a
    tag for it. I’ll see if I can duplicate the issue and fix it but I probably won’t get back to you until next week.

    Plugin Author Michael Simpson

    (@msimpson)

    I did some more research and some debugging. It appears that WordPress likes to wrap the contents of the inner content of shortcode tags in a br and a p tag (related to wpautop in case you are interested). It doesn’t always do this wrapping, e.g. if you have no tags at all it does not (don’t ask me why).

    So by the time my plugin code gets that text, it already has those tags in it. So I’m putting in a hack to see if the shortcode content starts with a br tag and ends with p tag and if so I’m stripping it out. I did a test and it looks OK.

    I hope to push out an update this week.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Contact Form 7 to Database Extension] cfdb-html adds extra’ is closed to new replies.