Plugin influence CF7 Send button style
-
It happened after last update yesterday.
-
It even mess with all input fields (styling) after conditional field. And mess with styling (or more, completely gone) select fields, if they are conditional fields. Tried to resave form but did not help.
Everything was nice before yesterday update.
It is this function and regex there making it:
wpcf7cf_properties
Dont know why it mess with button. For other fields I use Bootstrap “group” classes. You have to assume Bootstrap is very popular and plugin will ruin it.
Rename your shortcode attributes, not big deal.
Instead of “group group-830” it can be “cf-group cf-group-830”Good point. I’ll try to figure out a solution without having to rename the shortcodes though, because it will break all code for the people who update.
@stagger-lee Would you mind checking if this code works? I simplified the regex a little bit. If it doesn’t help, would you mind pasting the form code you are using?
Please just replace the wpcf7cf_properties function at line 152 contact-form-7-conditional-fields.php
function wpcf7cf_properties($properties, $wpcf7form) { if (!is_admin()) { $form = $properties['form']; $find = array( '/\[group\s?([^\s\]]*)\s?(.*?)\]/s', '/\[\/group\]/s' ); $replace = array( '<div id="$1" data-class="wpcf7cf_group">', '</div>' ); $form = preg_replace( $find, $replace, $form ); $properties['form'] = $form; } return $properties; }
Or this one might be even better:
function wpcf7cf_properties($properties, $wpcf7form) { if (!is_admin()) { $form = $properties['form']; $find = array( '/\[group\s*([^\s\]]*)\s*([^\]]*)\]/s', '/\[\/group\]/s' ); $replace = array( '<div id="$1" data-class="wpcf7cf_group">', '</div>' ); $form = preg_replace( $find, $replace, $form ); $properties['form'] = $form; } return $properties; }
So sorry for the multiple posts. But I think this one would be even better, since it wouldn’t match tags like [grouping group-1]
function wpcf7cf_properties($properties, $wpcf7form) { if (!is_admin()) { $form = $properties['form']; $find = array( '/\[group\s*\]/s', // matches [group ] or [group] '/\[group\s+([^\s\]]*)\s*([^\]]*)\]/s', // matches [group something some:thing] or [group something som ] // doesn't match [group-special something] '/\[\/group\]/s' ); $replace = array( '<div data-class="wpcf7cf_group">', '<div id="$1" data-class="wpcf7cf_group">', '</div>' ); $form = preg_replace( $find, $replace, $form ); $properties['form'] = $form; } return $properties; }
I updated the plugin with above code for version 0.1.4. Please let me know if it works for you
@jules I am sincerely sorry. I did not get those 4-5 e-mail notifications for your comments. Or maybe I have, but strange I would ignore all 4. Dont know now, maybe my memory is bad or some glitch in WP servers.
All is OK now, you can mark it as solved. All is OK with latest update.
No problem 😉 glad it worked out for you
- The topic ‘Plugin influence CF7 Send button style’ is closed to new replies.