Navigation überspringen

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.

2 Antworten bis “Divi - Library Items Displaying in Incorrect Language When Using Custom Shortcodes”

Hinterlassen Sie eine Antwort

Bitte bleiben Sie beim Thema und respektieren Sie andere. Wenn Sie Hilfe bei Problemen benötigen, die nicht mit diesem Beitrag zusammenhängen, nutzen Sie unser Support-Forum, um einen Chat zu starten oder ein Ticket zu erstellen.

Sie können diese Tags verwenden:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>