Support » Fixing WordPress » Contact Form 7 Display None

  • Has anyone found a problem like this
    A theme purchased has a Div around the inputs

    <div style=”display: none;”>
    <input name=”_wpcf7″ value=”4443″ type=”hidden”>
    <input name=”_wpcf7_version” value=”5.0.2″ type=”hidden”>
    <input name=”_wpcf7_locale” value=”en_GB” type=”hidden”>
    <input name=”_wpcf7_unit_tag” value=”wpcf7-f4443-p4458-o1″ type=”hidden”>
    <input name=”_wpcf7_container_post” value=”4458″ type=”hidden”>

    So does not display the form.

    From talking with the developer he gives me the impression the form he supplies is what he wants you to use. But says Contact Form 7 works with his theme.

    Change the theme back to 17 and the form appears knock out all the plugins in his theme and still it will not display the form.

    I have given up with the developer as I smell a rat with him but to much effort has been put in to abandon it now, also it was paid for.

    Any pointers would be a great help

Viewing 3 replies - 1 through 3 (of 3 total)
  • @magic101
    You are not able to see anything because the “div” is display none using the inline style.
    In addition to that, all the input fields inside that “div” are input type “hidden”, so they are supposed to be hidden.

    So overall, there is nothing to be displayed as far as provided HTML is concerned

    Thanks for that

    The (div Display None) is put in by the developers theme not by us we have put in a few forms on various pages and it does the same to everyone, yet change theme to 17 and the form shows every time as it is supposed to.

    This gives me the feeling that the theme is putting in the div to stop contact form 7 showing. I may be wrong but never in all my years have I seen this happen b4.
    Looking at other sites we have you do not see this div and we have never had this happen to any themes we have used.

    <div style=”display: none;”> wrapping around the form. This makes me feel the developer has some code somewhere that does this, for what reasons I do not know.

    Driving me nuts over 50hrs trying to find whats wrong.

    Just found this in functions.php of theme and wonder if its why contact form 7 does not appear on the page. look at the page code the form is not visible as it is wrapped in a div with display none, cf code is there but does not display the form

    /* Disable SPAN wrapper for CF7
    add_filter(‘wpcf7_form_elements’, function($content) {
    $content = preg_replace(‘/<(span).*?class=”\s*(?:.*\s)?wpcf7-form-control-wrap(?:\s[^”]+)?\s*”[^\>]*>(.*)<\/\1>/i’, ‘\2’, $content);
    return $content;

    add_filter(‘wpcf7_form_elements’, function( $content ) {
    $dom = new DOMDocument();
    $dom->preserveWhiteSpace = false;
    $dom->loadHTML(mb_convert_encoding($content, ‘HTML-ENTITIES’, ‘UTF-8’), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);

    $xpath = new DomXPath($dom);
    $spans = $xpath->query(“//span[contains(@class, ‘wpcf7-form-control-wrap’)]” );

    foreach ( $spans as $span ) :
    $children = $span->firstChild;
    $span->parentNode->replaceChild( $children, $span );

    return $dom->saveHTML();

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Contact Form 7 Display None’ is closed to new replies.