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 14 replies, has 3 voices.

Last updated by martineG-3 2 years, 10 months ago.

Assigned support staff: Francesco Di Candia.

Author Posts
November 16, 2017 at 12:48 pm #1432653

martineG-3

Hello,

On our website (main language is dutch) we've always used a custom field "plaats" (location) in our projects. For some reason this field won't show in the english or french translation anymore.

The field is selected to be translated, but when using WPML it won't show.

What can be wrong?
Thanks in advance for the help.
Tony
OUr website is hidden link

November 17, 2017 at 3:16 pm #1434084

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Martine,

Thank you for contacting our support forum.

You're saying that the field does not show up on the translations ?

Please let me know.

Thanks,
Shane

November 20, 2017 at 8:54 am #1435391

martineG-3

Hi Shane,

What I mean is that in the backend the custom field "Plaats" (location) doesn't show. So I can't fill out the translations and therefore the fields in the translation remain empty.

When editing a project in dutch (main language) the custom field "plaats" is showing. I can fill that out. But when I want to translate the page, this custom field is not displayed.

If you want I can send you a token, so you can see what I mean.
Thanks in advance, Tony

November 21, 2017 at 4:03 pm #1437221

Francesco Di Candia

Hello, my name is Francesco.
Since Shane currently has a few days off, I will replace him here in the forum.
I hope this is OK for you.
Have you recently updated some plugins?
❌ Before proceeding please make a full database and website backup! ❌
- Could you try to disable all plugins except WPML related?
- Temporarily change the theme to a default WordPress such as TwentyFifteen.
If the issue is gone, activate one by one to see with which one there is an interaction issue.
Let me know which plugin creates the problem,
thank you, Francesco

November 27, 2017 at 8:44 am #1442007

martineG-3

Hello Francesco,
I've tried to locate the cause of the problem, but I can't seem to find it.
What can I try next?
Thanks in advance.
Tony

November 27, 2017 at 2:29 pm #1442468

Francesco Di Candia

Hi,
as you can read here
https://wpml.org/documentation/beginners-guide-to-site-translation/translating-custom-fields/
going thru
- WPML -> Translation Management -> Multilingual Content Setup -> Custom Field Translation section
you have to check if you have your custom field configured to be translated.
Then you can proceed to translate it.
Thank you, Francesco.

November 28, 2017 at 8:31 am #1443102

martineG-3

Hello Franscesco,
Thanks for you reply. I'm aware of the documentation and that the custom field should be configured to be translated.
As you can see in the image the field "plaats"(location) is set to be translated.
(I also uploaded a picture of this setting in the first post).

So, settings seems to be correct. However The field is not showing in the translations.
Thanks in advance.
Tony

November 28, 2017 at 2:40 pm #1443743

Francesco Di Candia

Hi,
I would like to request temporary access (WordPress and FTP) to your site to take a better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.
For this, I'll need to install the Duplicator plugin on your site.
https://wordpress.org/plugins/duplicator/
I'll also install the ARI Adminer plugin (https://wordpress.org/plugins/ari-adminer/) to check the DB of your site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**
- Please make a backup of site files and database before providing us access.

- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Thank you, Francesco

November 30, 2017 at 5:57 pm #1446230

Francesco Di Candia

Hi, you're right, it's an issue connected to your child theme.
In your cfpm.php file there is a snippet of code that gets the Custom Field `plaats`without checking the language (cfpm.png).

<?php $postmeta = get_post_meta(get_the_ID(), 'plaats',true); 
	echo '<p class="custom-field">'.$postmeta.'</p>';
	?>

As you can read here
https://wpml.org/wpml-hook/wpml_object_id/
we can use the wpml_object_id WPML hook to have the correct ID of the translated project.
So, for instance, you can use this example in order to start to modify your code:

$current_language = apply_filters( 'wpml_current_language', NULL );
$projectId =  apply_filters( 'wpml_object_id', get_the_ID(), 'project', TRUE, $current_language);
$postmeta = get_post_meta($projectId, 'plaats',true); 
echo '<p class="custom-field">'.$postmeta.'</p>';

Please, let me know if this example helped you solve your problem or if you still need help.
Francesco

December 1, 2017 at 10:49 am #1446782

martineG-3

Hello Francesco,

Thanks for your reply.

I changed the code to

<?php $current_language = apply_filters( 'wpml_current_language', NULL );
$projectId =  apply_filters( 'wpml_object_id', get_the_ID(), 'project', TRUE, $current_language);
$postmeta = get_post_meta($projectId, 'plaats',true); 
echo '<p class="custom-field">'.$postmeta.'</p>';
?>

However, it doesn't seem to change anything.
I notice that in the backend the field "plaats" does appear in new to be translated projects. (project Bioscape), but in already translated projects it doesn't show.
Can you check if I mistyped something in above code?

Strange. All location data should be there since the beginning when I created the projects.
I don't see why the child theme suddenly doesn't work, since I didn't made any changes there.

For now I changed the code back to what it was, because I probably did something wrong with the code you suggested.

<?php $postmeta = get_post_meta(get_the_ID(), 'plaats',true); 
    echo '<p class="custom-field">'.$postmeta.'</p>';
    ?>

Thanks for all the help.
I'm puzzled at the moment. (i think for some reason the child theme is corrupt, since I was also experiencing problems with the pagination on the portfolio page. See thread on the Divi theme
hidden link

Tony

December 1, 2017 at 2:44 pm #1447035

Francesco Di Candia

Hi,
as you can see on this video hidden link, I can see the Custom Field both in old and new project, so please check for which projects it does not work.
Then, regarding the example snippet, please check if your Custom Field name is `project` as I wrote or it's written in NL so you have to change it according to the language.
Please read the documentation here
https://wpml.org/wpml-hook/wpml_object_id/
to get some ideas on how to create the code that can fit your needs.
Let me know, Francesco

December 4, 2017 at 10:30 am #1448343

martineG-3

Sorry Francesco to get back to you.
I can't seem to get it to work.
In your video I can see the custom field is showing in a new project (Bioscape).
In an older project (Lo2cus) (before the problems), the custom field is also showing in the dutch version (as seen in your streaming vid), but when selecting the pencil (for english or french version) to translate the fields, the custom field ('plaats') is not listed.
Sorry to bother you again, but a big thank you for helping me out.
Tony

December 4, 2017 at 10:54 am #1448379

martineG-3

Also enclosed a video to show you the problem.
hidden link
Tony

December 4, 2017 at 3:43 pm #1448793

Francesco Di Candia

Hi,
you can proceed using this steps:
- go to editing a non-working Project
- make a small variation (a dot, a comma, a space)
- save it, translate it
- in Translation Editor you will find the `field-plaats` custom field.
- translate it, check all the`Vertaling is voltooid` check boxes, save and close the translation.
- go to the default language and delete the small variation.
You can check out all this process on this video hidden link.
Francesco

December 7, 2017 at 9:03 am #1451544

martineG-3

OK Francesco,
I understand now. It'll be a lot of work, since there are 130+ projects, but it's a solution.
Thanks for all the help.
Tony