Skip Navigation

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.

This topic contains 9 replies, has 3 voices.

Last updated by linkeyparma 3 years, 7 months ago.

Assigned support staff: Yvette.

Author Posts
November 29, 2017 at 9:24 am #1444425

linkeyparma

Hello,

I am in touch with the customer care of YoloTheme for a compatibility issue between WPML and Sofani theme. They asked me to forward you the following message:

I have created a post type "Footer Block" to help users build them selves diferent footer styles on each page (Addon for Visaul Composer).
There is an option "Page footer" in each page and users can select one of theme that is built from Footer Block.
When I use the plugin "WPML" to translate with a new language, It seems that WPML created a new post and a new ID.
Being back with my option "Page footer", it allows users select a unique footer (a unique ID) => It's impossible to translate when redirecting the link to a new language. (hidden link)
-> It only displays a language.
- Which is your solution for this issue?

November 30, 2017 at 7:50 pm #1446325

Cristina

Hello,

thanks for contacting us on this and sorry for the delays.

WPML always assigns a different, new ID for each translated post, so if you are using a unique footer ID it will not be possible to assign to a translated post just like that.

If the footer block was a widget it could be made multilingual and assigned automatically to a language.

The other option would be to add a filter to the function that shows the blocks where the language and object ID is retrieved to enable it to retrieve the actual language information and to return the correct object.

We have an API and a page with Hook samples that may be useful for the theme developer regarding this:
https://wpml.org/documentation/support/wpml-coding-api/
https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/

I have not understood completely if this block is a theme option or a customization form your site.

As this theme is not in our official compatibility list, I need to follow the protocol established for new/uncompatible plugins/themes which include the following steps:

1. Verification of the problem on your site and on a fresh installation
For this we would need to use your site as test and download a thin duplicate in order to reproduce the problem also in a clean install.

3. Escalation of the problem to our compatibility team
We will try to find a workaround and provide it for you, but this will be done only if it is a minor and harmless change that does not affect the correct function of the site.

From there, the team will confirm the exact issue and contact the theme author to invite them to join the GoGlobal program.

In this program, they will receive full support to address the identified compatibility issue and suggest fixes so that the theme will be compatible with WPML.

This also means that the time required to make a theme compatible with WPML depends on the availability and willingness of the authors to work with our team.

It can be a quick and easy fix with the final solution being delivered by the theme author in the next release of their product and a temporary workaround provided to you as our shared client. In some rare cases it may be not solvable if both the theme and WPML work too differently.

Therefore I am enabling a private reply box for you, where you can paste access data that only you and the support will see. If you can provide with a duplicate of the site, it can be enough to reproduce the problem and make a test case. ¡

Thank you and kind regards,
Cristina

December 1, 2017 at 6:23 pm #1447385

Cristina

Hello Stefano,

thanks for the access, I could take a look a the site and I installed the duplicate to check it.

The issue can be resolved without any work from the author with just the WPML configuration settings. Maybe the author was not aware of the way WPML works, but this will be good news for him.

Here is what I did on the test site and what I have done on your site too, as I assume that you want to show the two footer blocks each on one language:

First:
I changed the Footer title for the English translation of the Footer Block to Footer EN to be able to distinguish it.

Second:
I went to the theme options and checked that, with the italian flag enabled, the option for the footer block was Footer 4 and saved it.

Then I changed the flag in the top admin bar to English and changed the Footer to be Footer EN and saved.

Third:
- I went to the Italian homepage and edited it:
-In the theme options at the bottom I chose Footer 4.
- Then I saved the page and went again to the bottom of the page.
- Now the custom field for the footer appeared in the list of custom fields.
- I set the field yolo_footer to "traduci" and saved the page again.

Fourth:
I edited the english translation starting from the frontend, and as the field now was set to translate, I could enable the Footer 4 EN in the theme options at the bottom of the page.

After saving, your italian pages now show the italian footer and the english pages show the english footer.

So this should be ok with your site.
In case you don't want it that way, please forgive that I just changed it.

I attach the screenshots of the settings in case you want to redo it.

Kind regards,
Cristina

FooterBlocks2EN.png
FooterBlocks.png
CustomField.png
ChooseFooter.png
December 4, 2017 at 9:42 am #1448269

linkeyparma

Hello Cristina,

thank you for the very clear explanation.
I can confirm you that everything works fine in the footer now.

Best regards,

Stefano

December 4, 2017 at 10:19 am #1448323

linkeyparma

Hello Cristina,

sorry if I have to re-open the ticket.
I have seen that the modification about the EN version of the footer is not propagated to the pages of the website other than the home page. Of course I have verified that forcing the choice of 'Footer 4 EN' on the pages (such as [website url]/en/cart) the latter is visualized correctly. I find this solution anyway a little tricky for our customer. Would it be possible to make sure the 'Footer 4 EN' choice is automatically activated when 'Page Options-->Page Footer-->Default' is selected on English version pages ?

Thank you,

best regards

Stefano

December 5, 2017 at 11:08 am #1449528

Cristina

Hallo Stefano,

For existing products you need to update each page, as the information need to be updated for the block.

For a new product, if you edit a translation, the footer block ID will appear in the translation editor and you can put in the field the ID of the translated footer block, but if will not be changed automatically.

I have escalated this to the compatibility team, because I am not sure if this is possible.

So we will follow the process for new themes and check if there is a workaround we can provide for this issue.

Kind regards,
Cristina

December 20, 2017 at 11:47 am #1462497

Cristina

Hello Stefano,

my colleagues have provided a workaround for this that will enable you to show the translated footer in all pages without having to change it manually:

For the custom field we need to set yolo_footer custom field to copy.
Add this to the custom XML configuration you will find in WPML > Gestione traduzioni >Configurazione XML personalizzata:

<wpml-config>
<custom-fields>
<custom-field action="copy">yolo_footer</custom-field>
</custom-fields>
</wpml-config>

Then visit the page WPML > Localizzazione del tema e dei plugin to activate it.

Then you need to go the functions.php file in your theme folder and add this code at the end of the functions.php file:

add_filter( 'get_post_metadata', 'yolo_footer_cf_translate', 10, 4 );
function yolo_footer_cf_translate( $return, $object_id, $meta_key, $single ) {
    if ( $meta_key == 'yolo_footer' ) {
        global $wpdb;

        $value = $wpdb->get_var( $wpdb->prepare(
            "SELECT meta_value FROM $wpdb->postmeta
                WHERE meta_key = 'yolo_footer' AND post_id = '%d'", $object_id ) );
        $return = apply_filters( 'wpml_object_id', $value, 'yolo_footer', true );
    }
    return $return;
}

With this code, if the translation for a footer exists and you choose the original footer in the default language, the translation will show automatically also the translated footer.

We have checked this on the test site and if you can confirm this also works for you we will contact the author with this solution too.

Kind regards,
Cristina

December 21, 2017 at 10:43 am #1463516

linkeyparma

Hello Cristina,

many thanks for the important update.
I have followed the steps you suggested; as for the following part

"Then visit the page WPML > Localizzazione del tema e dei plugin to activate it."

I simply visited the page without clicking on any button.

As a test I have created an English translation of the existing page [website url]/azienda:

[website url]/en/company

I clicked on 'Overwrite with the Italian content', I added the translations with Visual Composer, and then I clicked 'Aggiorna'.
The footer for the English page is still visualized in Italian.

Could you please verify directly on the website why this is happening ?

Thank you for your collaboration,

best regards

Stefano

December 21, 2017 at 12:41 pm #1463667

Yvette
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/Rome (GMT+02:00)

Hello

The "fix" provided did not cover the case where your page was using the "default" footer block that is set in your theme options.

For this case, you need to add the additional tag in the Custom XML settings:

   <admin-texts>
       <key name="yolo_sofani_options">
         <key name="footer"/>
       </key>
  </admin-texts>

Then you will translate the page-id for Footer 4 with the page-id of the Footer 4EN page (see images)

Now, the page shows the correct footer.

GetPostIdsFooterBlocks.png
AdditionalXMLTags.png
TranslateTheDefaultSetting.png
December 22, 2017 at 10:02 am #1464386

linkeyparma

Hello Yvette and Cristina,

I can confirm you that now everything works perfectly.

Thank you for your support and collaboration.

Happy holidays,

Stefano