Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?= do_shortcode('[contact-form-7 id="111" title="blabla"]') ?>
- <?php
- function hidden() {
- //Поля формы
- $source = isset($_REQUEST['utm_source']) ? $_REQUEST['utm_source'] : '' ;
- $term = isset($_REQUEST['utm_term']) ? $_REQUEST['utm_term'] : '' ;
- $campaign = isset($_REQUEST['utm_campaign']) ? $_REQUEST['utm_campaign'] : '' ;
- $medium = isset($_REQUEST['utm_medium']) ? $_REQUEST['utm_medium'] : '' ;
- $content = isset($_REQUEST['utm_content']) ? $_REQUEST['utm_content'] : '';
- $html = '<input type="hidden" name="source" class="source" id="utm_source" value="'.$source.'" />';
- $html .= '<input type="hidden" name="term" class="term" id="utm_term" value="'.$term.'" />';
- $html .= '<input type="hidden" name="campaign" class="campaign" id="utm_campaign" value="'.$campaign.'" />';
- $html .= '<input type="hidden" name="medium" class="medium" id="utm_medium" value="'.$medium.'" />';
- $html .= '<input type="hidden" name="content" class="term" id="utm_content" value="'.$content.'" />';
- return $html;
- }
- wpcf7_add_form_tag('hidden', 'hidden', false);
- ?>
- $html .= '<input type="hidden" name="city" class="wpcf7-form-control wpcf7-hidden js-city-input" value="" />';
- function updateDeliveryInfo(){
- var geolocation = ymaps.geolocation;
- if(geolocation.city){
- $('.js-city-input').val(geolocation.city);
- $('.js-city').text(geolocation.city);
- $('.city').show();
- }
- }
- add_action( 'wpcf7_init', 'my_wpcf7_add_form_tag_hidden', 0 );
- function my_wpcf7_add_form_tag_hidden() {
- remove_action( 'wpcf7_init', 'wpcf7_add_form_tag_hidden' );
- wpcf7_add_form_tag( 'hidden',
- 'my_wpcf7_hidden_form_tag_handler',
- array(
- 'name-attr' => true,
- 'display-hidden' => true,
- )
- );
- }
- function my_wpcf7_hidden_form_tag_handler( $tag ) {
- $source = isset( $_REQUEST['utm_source'] ) ? $_REQUEST['utm_source'] : '';
- $term = isset( $_REQUEST['utm_term'] ) ? $_REQUEST['utm_term'] : '';
- $campaign = isset( $_REQUEST['utm_campaign'] ) ? $_REQUEST['utm_campaign'] : '';
- $medium = isset( $_REQUEST['utm_medium'] ) ? $_REQUEST['utm_medium'] : '';
- $content = isset( $_REQUEST['utm_content'] ) ? $_REQUEST['utm_content'] : '';
- $html = '<input type="hidden" name="source" class="source" id="utm_source" value="' . $source . '" />';
- $html .= '<input type="hidden" name="term" class="term" id="utm_term" value="' . $term . '" />';
- $html .= '<input type="hidden" name="campaign" class="campaign" id="utm_campaign" value="' . $campaign . '" />';
- $html .= '<input type="hidden" name="medium" class="medium" id="utm_medium" value="' . $medium . '" />';
- $html .= '<input type="hidden" name="content" class="term" id="utm_content" value="' . $content . '" />';
- if ( empty( $tag->name ) ) {
- return $html;
- }
- $atts = array();
- $class = wpcf7_form_controls_class( $tag->type );
- $atts['class'] = $tag->get_class_option( $class );
- $atts['id'] = $tag->get_id_option();
- $value = (string) reset( $tag->values );
- $value = $tag->get_default_option( $value );
- $atts['value'] = $value;
- $atts['type'] = 'hidden';
- $atts['name'] = $tag->name;
- $atts = wpcf7_format_atts( $atts );
- $html .= sprintf( '<input %s />', $atts );
- return $html;
- }
Add Comment
Please, Sign In to add comment