Salta la navigazione

Open

Topic Tags: Compatibility

Overview of the issue

Users of the Divi theme have encountered an issue where translated library items do not display correctly in the Divi builder when a page includes a custom shortcode. This occurs specifically when the ‘Add from Library’ feature is used while editing translated pages in the Divi builder. The library displays content in the default language instead of the translated language.

Please not that our recommended workflow for translating sites created with Divi is using the Advanced Translation Editor (ATE).

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open your theme’s functions.php file.
  • Add the following code:
    
    
  • With:
    // WPML: Workaround for compsupp-7452
    function wpml_compsupp7452_fix_divi_editor_ajax_lang() {
        if ( isset($_POST['is_fb_preview']) && $_POST['is_fb_preview'] == 'true' ) {
    
            foreach ($_COOKIE as $name => $value) {
                if (strpos($name, 'wp-wpml_current_admin_language') === 0) {
                    $my_current_lang = apply_filters( 'wpml_current_language', NULL );
    
                    if ( $my_current_lang != $value ) {
                        do_action( 'wpml_switch_language', $value);
                    }
                    break;
                }
            }
        }
    }
    
    add_action('et_builder_structure_elements_loaded', 'wpml_compsupp7452_fix_divi_editor_ajax_lang');
    

Alternative Workaround

Use the Advanced Translation Editor (ATE) for translating pages, which avoids issues related to manual translations and ensures that all elements of the page, including those pulled from the library, are correctly displayed in the intended language.

Lasciare una risposta

Ti preghiamo di rimanere in tema e di essere rispettoso nei confronti degli altri. Se hai bisogno di aiuto per questioni non correlate a questo post, utilizza il nostro Forum di supporto per avviare una chat o inviare un ticket.

Potete usare questi tag:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>