Panoramica del problema
Quando usi WP Configurator Pro con WPML, potresti riscontrare i seguenti problemi: su un prodotto WooCommerce tradotto collegato a un configuratore, il titolo del configuratore sostituisce il titolo del prodotto, la descrizione del configuratore rimane in inglese e i testi del PDF non possono essere tradotti.
Soluzione alternativa
Aggiungi il seguente codice al file functions.php del tuo tema child:
PHP
add_filter( 'the_title', function ( $title, $id = 0 ) {
if ( ( is_admin() && ! wp_doing_ajax() ) || ! $id || 'product' !== get_post_type( $id ) ) {
return $title;
}
$post = get_post( $id );
return $post ? $post->post_title : $title;
}, 11, 2 );
add_filter( 'do_shortcode_tag', function ( $out, $tag, $attr ) {
if ( 'wpc_config_description' !== $tag || empty( $attr['id'] ) ) {
return $out;
}
$id = absint( $attr['id'] );
return wp_kses_post( apply_filters( 'wpc_single_product_description', get_post_meta( $id, '_wpc_description', true ), $id ) );
}, 10, 3 );Vai su WPMLImpostazioni e aggiungi quanto segue alla Configurazione XML personalizzata:
XML
<wpml-config>
<admin-texts>
<key name="wpc_pdf_document_heading" />
<key name="wpc_pdf_download_btn_text" />
</admin-texts>
</wpml-config>Quindi traduci i testi in WPMLTraduzione stringhe.