magic101
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Contact Form 7 Display NoneJust 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 );
endforeach;return $dom->saveHTML();
});Forum: Fixing WordPress
In reply to: Contact Form 7 Display NoneThanks 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.