- Stato
- Risolto
- Segnalato per
- WPML Multilingual for CF7 1.2.1
- Risolto in
- Contact Form 7 Multilingual 1.2.2
- Plugin/tema correlato
- Contact Form 7
- Tag dell’argomento
- Compatibility
Panoramica del problema
Quando aggiungi dei moduli utilizzando il plugin Contact Form 7 e il metodo PHP do_shortcode(), i moduli non appaiono tradotti come previsto.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Apri il file …/wp-content/plugins/contact-form-7-multilingual/classes/shortcodes.php.
- Cerca la riga 21.
- Sostituisci:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; } - Con:
public function translate_shortcode_form_id( $atts ) { $form = null; if ( ! empty( $atts['id'] ) && is_numeric($atts['id']) ) { $form = wpcf7_contact_form( (int) $atts['id'] ); } if ( ! $form && ! empty( $atts['title'] ) ) { $form = wpcf7_get_contact_form_by_title( trim( $atts['title'] ) ); unset( $atts['title'] ); } if ($form == null){ $form = wpcf7_get_contact_form_by_hash( $atts['id']); } if ( $form ) { $atts['id'] = apply_filters( 'wpml_object_id', $form->id(), Constants::POST_TYPE, true ); } return $atts; }