콘텐츠로 건너뛰기 사이드바로 건너뛰기

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:
    1
     
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    // 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 개의 답변 에 “Divi - Library Items Displaying in Incorrect Language When Using Custom Shortcodes”

답글 남기기

주제에 충실하고 다른 사람들을 존중해 주세요. 이 게시물과 관련 없는 문제에 대해 도움이 필요하다면, 지원 포럼을 이용하여 채팅을 시작하거나 티켓을 제출하세요.

다음 태그를 사용할 수 있습니다:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>