- Statut
- Résolu
- Signalé pour
- WPML Multilingual for CF7 1.2.1
- Résolu dans
- Contact Form 7 Multilingual 1.2.2
- Extension/thème associé
- Contact Form 7
- Étiquettes de sujet
- Compatibility
Aperçu de l’anomalie
Lors de l’ajout de formulaires à l’aide de l’extension Contact Form 7 et de la méthode PHP do_shortcode(), les formulaires n’apparaissent pas traduits comme prévu.
Solution de contournement
Assurez-vous d’avoir une sauvegarde complète de votre site avant de continuer.
- Ouvrez le fichier …/wp-content/plugins/contact-form-7-multilingual/classes/shortcodes.php.
- Cherchez la ligne 21.
- Remplacez :
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; } - Par :
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; }