acceptance.php
7 years ago
akismet.php
7 years ago
checkbox.php
7 years ago
constant-contact.php
7 years ago
count.php
7 years ago
date.php
7 years ago
file.php
7 years ago
flamingo.php
7 years ago
hidden.php
7 years ago
listo.php
9 years ago
number.php
7 years ago
quiz.php
7 years ago
really-simple-captcha.php
7 years ago
recaptcha.php
7 years ago
response.php
7 years ago
select.php
7 years ago
submit.php
7 years ago
text.php
7 years ago
textarea.php
7 years ago
hidden.php
37 lines
| 1 | <?php |
| 2 | |
| 3 | add_action( 'wpcf7_init', 'wpcf7_add_form_tag_hidden', 10, 0 ); |
| 4 | |
| 5 | function wpcf7_add_form_tag_hidden() { |
| 6 | wpcf7_add_form_tag( 'hidden', |
| 7 | 'wpcf7_hidden_form_tag_handler', |
| 8 | array( |
| 9 | 'name-attr' => true, |
| 10 | 'display-hidden' => true, |
| 11 | ) |
| 12 | ); |
| 13 | } |
| 14 | |
| 15 | function wpcf7_hidden_form_tag_handler( $tag ) { |
| 16 | if ( empty( $tag->name ) ) { |
| 17 | return ''; |
| 18 | } |
| 19 | |
| 20 | $atts = array(); |
| 21 | |
| 22 | $class = wpcf7_form_controls_class( $tag->type ); |
| 23 | $atts['class'] = $tag->get_class_option( $class ); |
| 24 | $atts['id'] = $tag->get_id_option(); |
| 25 | |
| 26 | $value = (string) reset( $tag->values ); |
| 27 | $value = $tag->get_default_option( $value ); |
| 28 | $atts['value'] = $value; |
| 29 | |
| 30 | $atts['type'] = 'hidden'; |
| 31 | $atts['name'] = $tag->name; |
| 32 | $atts = wpcf7_format_atts( $atts ); |
| 33 | |
| 34 | $html = sprintf( '<input %s />', $atts ); |
| 35 | return $html; |
| 36 | } |
| 37 |