Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 0 voices.

Last updated by Waqas Bin Hasan 7 hours, 2 minutes ago.

Assisted by: Waqas Bin Hasan.

Author Posts
July 31, 2025 at 10:59 am

kennethD-13

Background of the issue:
I have purchased the WPML plugin and a WP theme. I am trying to use the plugin to translate my website, hidden link, but the frontpage design isn't being translated correctly.

Symptoms:
The frontpage is not being designed properly; it's creating a sub-page instead of a duplicated frontpage, and the design looks incorrect. There are also issues with translating headlines, slides, and portfolios.

Questions:
Why is the frontpage not being designed properly with WPML?
How can I fix the translation issues with headlines, slides, and portfolios?

July 31, 2025 at 12:53 pm
July 31, 2025 at 1:41 pm #17285239

kennethD-13

Hello Waqas,

Had to migrate the website to the hidden link - the same login is still active 🙂

July 31, 2025 at 2:13 pm #17285347

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for the updates. I am working on this (need some more time) and 'll get back to you by tomorrow.

August 1, 2025 at 6:23 am #17287027

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

I just wanted to update you that I've resumed working on it and 'll update you soon today.

Thank you for your patience and cooperation.

August 1, 2025 at 8:44 am #17287419

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

Most of the sections, texts and buttons are now translated on the home page. I've updated Slides and some Portfolios to reflect the translations correctly. Simply edit the Slide or Portfolio in default language, save and update the translation.

However, 2 widgets (Block with Icons and Social Icons - see attached) are using an "icon" attribute which stores the information in URL Encoded format, like below:

[like_sc_block_icon type="ltx-icon-ht-right" header_type="6" icon-size="default" icon-color="main" header-color="default" bg-col="transparent" layout="layout-cols3" align="center" icons="%5B%7B%22header%22%3A%22Danish%20Test%20Header%20for%20Block%20With%20Icons%201%22%2C%22descr%22%3A%22Danish%20Test%20Description%20for%20Block%20With%20Icons%201%22%2C%22href%22%3A%22https%3A%2F%2Fgolden-harmonica.sandbox.otgs.work%2Fsample-page%2F%22%2C%22target%22%3A%22self%22%2C%22icon_fontawesome%22%3A%22fa%20fa-solid%20fa-circle-question%22%2C%22icon_text%22%3A%22Danish%20Icon%20Text%20for%20Block%20with%20Icons%201%22%7D%2C%7B%22header%22%3A%22Danish%20Test%20Header%20for%20Block%20With%20Icons%202%22%2C%22descr%22%3A%22Danish%20Test%20Description%20for%20Block%20With%20Icons%202%22%2C%22href%22%3A%22https%3A%2F%2Fgolden-harmonica.sandbox.otgs.work%2Fsample-page%2F%22%2C%22target%22%3A%22self%22%2C%22icon_fontawesome%22%3A%22fa%20fa-solid%20fa-audio-description%22%2C%22icon_text%22%3A%22Danish%20Icon%20Text%20for%20Block%20with%20Icons%202%22%7D%5D" id="" class="" css=""]

Notice the "icons" attribute.

I added the following to WPML -> Settings -> Custom XML Configuration:

    <shortcode>
      <tag>like_sc_block_icon</tag>
      <attributes>
        <attribute>icons</attribute>
      </attributes>
    </shortcode>
    <shortcode>
      <tag>like_sc_social_icons</tag>
      <attributes>
        <attribute>icons</attribute>
      </attributes>
    </shortcode>

Although this isn't needed because the value of "icons" attribute appears in Advanced Translation Editor (ATE) by default (search for % in ATE). You can translate these values but you've to take care of URL Encoding (i.e. those %XX based content) when translating the text encapsulated within these codes.

Since this is coming from an incompatible theme (Hub2B), you may need to check with theme author for a compatibility with WPML (particularly for the above mentioned).

WPML by default supports WP Bakery widgets, as you can see. Custom widgets can also be registered using custom XML configuration. But ATE does not support custom formats of the content being sent for translation. In some compatible plugins/themes cases, ATE support such special content via encoding but this isn't covered.

I'm discussing with my team that if we're going to support it or not and 'll update you accordingly.

Screenshot 2025-08-01 123307.jpg
Screenshot 2025-08-01 123223.jpg
August 1, 2025 at 10:55 am #17287995

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for your patience and cooperation.

It turns out that WPML has support for URL Encoded Shortcodes. So now everything on the home page should be fine. I've also updated the home page translation, as well as, one Portfolio post translation. For the rest of the Portfolio posts, simply open for editing in default language, save without any change and update the translation. Please note that if you see links are not pointing well to the translated version, edit the translation and adjust manually.

The support for URL Encoded shortcodes was added by the followings:

1) Added the following code (as mentioned in the guide also) with needed fields name modifications, to the functions.php file of your active theme:

// See https://wpml.org/documentation/support/translating-urlencoded-shortcodes/#translating-values-in-urlencoded-shortcodes for details.
add_filter( 'wpml_pb_shortcode_encode', 'wpml_pb_shortcode_encode_urlencoded_json', 10, 3 );
function wpml_pb_shortcode_encode_urlencoded_json( $string, $encoding, $original_string ) {
    if ( 'urlencoded_json' === $encoding ) {
        $output = array();
        foreach ( $original_string as $combined_key => $value ) {
            $parts = explode( '_', $combined_key );
            $i = array_pop( $parts );
            $key = implode( '_', $parts );
            $output[ $i ][ $key ] = $value;
        }
        $string = urlencode( json_encode( $output ) );
    }
    return $string;
}
 
add_filter( 'wpml_pb_shortcode_decode', 'wpml_pb_shortcode_decode_urlencoded_json', 10, 3 );
function wpml_pb_shortcode_decode_urlencoded_json( $string, $encoding, $original_string ) {
    if ( 'urlencoded_json' === $encoding ) {
        $rows = json_decode( urldecode( $original_string ), true );
        $string = array();
        foreach ( $rows as $i => $row ) {
            foreach ( $row as $key => $value ) {
            if ( in_array( $key, array( 'header', 'descr', 'icon_text', 'href' ) ) ) {
                    $string[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => true );
                } else {
                    $string[ $key . '_' . $i ] = array( 'value' => $value, 'translate' => false );
                }
            }
        }
    }
    return $string;
}

2) Then added encoding="urlencoded_json" to the custom XML as below:

    <shortcode>
      <tag>like_sc_block_icon</tag>
      <attributes>
        <attribute encoding="urlencoded_json">icons</attribute>
      </attributes>
    </shortcode>
    <shortcode>
      <tag>like_sc_social_icons</tag>
      <attributes>
        <attribute encoding="urlencoded_json">icons</attribute>
      </attributes>
    </shortcode>

3) And finally opened the page for editing in default language, resaved and updated the translation.

August 4, 2025 at 7:35 am #17291879

kennethD-13

Hey Waqas,

Thank you so much for all of your help. I hope you had a nice weekend.

I have a few issues still, but not a lot. I turned on the auto-translator and that fixed most - headlines, buttons etc. But:

1) When I update an image, its not being updated on the English version ? Do I need to do something separately ?

2) Widget area. Some is translated, some is not ?

3) I's not sure I understand the thing about the portfolio ? Some of the "icon headlines" size, capacity, amenities etc. have been translated - others havent. I might have been you, but when I try to find the icons, so I cant translate them under the portfolio, they are only attached in the translated version on some of them. Did you do something there or does it have something to do with the code above ?

Best,

Maria

August 4, 2025 at 10:15 am #17292581

Waqas Bin Hasan
WPML Supporter since 05/2014

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Please consider following:

1) If you want to use different images per language, you 'll need to use WPML Media Translation. However, if you want to use same images across languages, then no need of it, but in both cases there are settings in WPML -> Settings -> Media Translation which can be used to handle this.

Please see the attached image (media translation settings.jpg). First part of these settings (till the "Start" button) is a wizard which you can use to fix the said issue. This makes your uploaded image (to a page, post or featured - considered an attachment), available in all languages.

The second part controls the settings, as you want to deal with the media when uploaded.

2) Please see our guide on Translating Widgets for more details.

3) I only updated first polio as shown in the attached image (portfolio-01.jpg). You can follow these steps for rest of the portfolios:
- Go to Portfolios.
- Open the portfolio for editing in default language.
- Simply save the portfolio without making a change.
- Update the translation, ensure it is 100% and complete it.
- Clear cache and recheck.
- Repeat these steps for each portfolio which you isn't showing as translated on the frontend.

The above code enabled the recognition of these URL encode fields, so the translations need to be updated as mentioned in these steps. The same applies to every place in your site where these blocks/widgets have been used.

portfolio-01.jpg
media translation settings.jpg