Hello Elliot,
Here is what I did to make it work. It was more simple that what we thought 🙂
1. I went to wpml /general settings / translation configuration.
(Sorry if it’s not exactly like this in English, mine is in French..)
2. I check the relationship field. I changed it from “copy of the orginal” to “to translate”.
3. I went back in the post in the secondary languages where Advanced custom fields allow me to select the related posts. There, I removed the already selected post and I added them again. Then, I update my posts.
4. I removed $posts = lang_object_ids( get_field(‘relation_sejour_chambre’), ‘post’ ); and I put back $posts = get_field(‘relation_sejour_chambre’);
5. I went frontend and I updated the page. It worked 🙂
I still have one problem and I’ve create a new ticket for it but I think it’s more something for wpml than for you 🙂 : http://wpml.org/forums/topic/wrong-link-to-the-translated-pages-relationship-field-wpml-adv-custom-fields/
Anyway, if you have an idea 🙂
Thank you for the help you gave me Elliot !
Hello Elliot,
I think that I’ve found the solution. I come back to you later, I’ll make more tests first ! 🙂
Thank you !
Hello Elliot,
Thank you for your answer.
I’ve changed the relationship field to return an array of ID’s.
1. In french (main language), I got this result :
“array(6) { [0]=> int(170) [1]=> int(169) [2]=> int(142) [3]=> int(141) [4]=> int(140) [5]=> int(138) } ”
2. In the two secondary languages, I got this result : “array(0) { } ”
It’s like it didn’t record the id’s of the posts in the secondary languages…
What can I do ?
Thank you for your help !
Hello Elliot,
Here http://pastebin.com/3FxrprJr ,
you can see the output of “var_dump(get_field(‘relation_sejour_chambre’) );”.
I got all the data’s in French (Primary language) but none in the secondary languages (Nl and En)
As you said, currently both French and En Url’s produce an empty array for both but only since yesterday when Andreas from WPML plugin has asked me to add :
1. this function in my functions file : http://pastebin.com/V3v1UBvP
2. Replace $posts = get_field(‘relation_sejour_chambre’);
with $posts = lang_object_ids( get_field(‘relation_sejour_chambre’), ‘post’ );
Since I did action number 2, I got this error :
Catchable fatal error: Object of class WP_Post could not be converted to string in /homez.533/reloukin/vm/wp-content/plugins/sitepress-multilingual-cms/inc/template-functions.php on line 179
And the result of this error is an empty echo array on the page in the main language french.
If I let action number 2 as it was before, I got a nice arrow in french (main language) and “array(0) { } ” in the secondary languages…
What do you think ?
Thank you for your help !
Here we go : http://pastebin.com/yCHiXEFJ
Thank you !
Hello Elliot,
ACF retrieved perfectly the custom field data when I use the primary language. I’ve also well selected the values for each page in the different language.
I’ve used your tuto (http://www.advancedcustomfields.com/resources/tutorials/querying-relationship-fields/) and it worked perfectly in French (the main language of the website).
But I can’t make it work like this for the secondary languages…
You can check over here :
– Main language (Fr): http://www.velo-montagne.com/sejour-gastronomique/sejour-gastronomique-mi-semaine/ (the table is well generated at the end of the page)
Secondary languages
– (Nl) : http://www.velo-montagne.com/nl/gastronomisch-verblijf/een-midweek-gastronomisch-verblijf/
– (En) : http://www.velo-montagne.com/en/gastronomical-stay/gastronomical-mid-week-stay/
Can you have a look at this ? It’ll help you to undertand what I’m doing…
Do you know how to fix this ? I think that WPML and ACF are very close to make this work but I don’t know how !
Elliot, can you have a look at this problem ?
I can send you a few $ with Paypal if you can help me to correct this quickly ! I really need a solution !
Thank you for your help and understanding 😀
Depending on the version of ACF, I get different results.
With an old version of acf, i get an arrow containing the id’s of the original articles and not of the translated ones
OR
with the last version of acf i get array(0) { }
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.