Cet utilisateur n'a aucun sujet favori.
Sujets de forum favoris
Sujets de forum créés
| Statut |
Sujet
|
Support | Voix | Messages | Fraîcheur |
|---|---|---|---|---|---|
|
auvieuxduluth.com
1
2
Commencé par : cynthiaP
dans : Assistance en français
problème: Cela se produit parce que vous utilisez la traduction manuelle, Par defaut, avec l'éditeur de traduction WPML. WPML est configuré pour copier ces champs d'identifiant lors des traductions, ce qui élimine ce problème. Selon la manière dont vous effectuez votre traduction manuellement, j'ai une solution de contournement qui, au lieu de rechercher l'identifiant exact, recherche tout shortcode de Grid du même type : - Ajoutez ceci au fichier functions.php de votre thème enfant. Je l'ai testé localement et cela fonctionne. Vous devriez faire une sauvegarde de votre site avant de continuer : /**
* Fix WPBakery Grid + WPML - shortcode ID mismatch
*/
add_filter( 'vc_basic_grid_find_post_shortcode', 'fix_vc_grid_wpml', 10, 3 );
function fix_vc_grid_wpml( $shortcode, $page_id, $grid_id ) {
if ( $shortcode !== false ) {
return $shortcode;
}
$tag = isset( $_REQUEST['tag'] ) ? sanitize_text_field( $_REQUEST['tag'] ) : '';
if ( empty( $tag ) ) {
return $shortcode;
}
// Look for ANY shortcode of the same type in the page's meta
$meta = get_post_meta( (int) $page_id, '_vc_post_settings', true );
if ( isset( $meta['vc_grid_id']['shortcodes'] ) ) {
foreach ( $meta['vc_grid_id']['shortcodes'] as $data ) {
if ( isset( $data['tag'] ) && $data['tag'] === $tag ) {
return $data;
}
}
}
// Fallback: check translated page if WPML active
if ( function_exists( 'icl_object_id' ) ) {
$languages = apply_filters( 'wpml_active_languages', null );
foreach ( (array) $languages as $lang => $info ) {
$other_id = apply_filters( 'wpml_object_id', $page_id, 'page', false, $lang );
if ( $other_id && $other_id != $page_id ) {
$meta = get_post_meta( (int) $other_id, '_vc_post_settings', true );
if ( isset( $meta['vc_grid_id']['shortcodes'] ) ) {
foreach ( $meta['vc_grid_id']['shortcodes'] as $data ) {
if ( isset( $data['tag'] ) && $data['tag'] === $tag ) {
return $data;
}
}
}
}
}
}
return $shortcode;
} |
|
0 | 23 | Il y a 3 semaines et 6 jours |