Follow up…
I solved this problem by creating two separate Field Groups. So I didn’t use WPML’s translate or duplicate buttons. First I created a Field Group with my native language and made sure that “Language of this advanced custom fields” field had my native language. Than I created a new Field Group with exactly the same data, but this time I changed the “Language of this advanced custom fields” to my second language and changed the “Page is equal to” rule to correspond my translated page.
Anyway… there is still something strange with Location Rules and pages without corresponding translation.
Hi @nytrm
Does this mean the problem has solved itself?
Hi @frg004
Perhaps you could post the code you are using to get the data and render it?
Hi @elliot
I have attached a image of a small part of this list.
When using the WPML Translation Management plugin follow these steps to get there:
Some ACF fields are not displayed in this section.
If you need more information/screenshots let me know.
Thanks!
EDIT: It seems that i do see the new fields, now having a mixture between field keys and field names. used to be only field names to be displayed but now the new created fields are shown as field keys instead of field names.
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 😀
Hi @nytrm
Sorry, I am not that familiar with the translation-management->Custom fields translation list.
Perhaps you could include some screenshot to help show the issue?
Hi @frg004
ACF is an interface for saving / retrieving custom field data, I think what you are expecting is above what ACF is capable of doing.
For each translated page, you will need to select the values in the relationship field. It will not do this automatically
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) { }
The correct constant is ICL_LANGUAGE_CODE
:
http://wpml.org/documentation/support/wpml-coding-api/
Prefixing is not really maintainable because I don’t know which languages our client will add… And can become a mess.
Creating a “global variables page” is what I was doing before using ACF Options… So I’d rather not regress 😛
For now I think I will replace “translatable” fields in the Options page by Repeaters ones, in which the key will be the language code.
It’s a shame that it’s not better handled, is it on your roadmap to enhance this Elliot ? It’s really a pleasure to work on complex and multilingual sites with ACF and WPML, except this part 😉
Well I dont know if I understood well, but for me it worked well in 4 languages site.
I’ve created a set of Custom Fields in my main language, but than had to translate this set for the other 3 languages.
Initially I forgot to translate a few fields on the Spanish set, so when I was doing the post translation to Spanish there where some things missing.
But I have other problem. Two of my Advanced Custom Fields are checkboxes populated by taxonomies. The thing is that there is taxonomy of ‘materials’, and some of the material have the same name in all the 4 languages. Things like ‘PVC’. In cases like this WPML adds ‘@en’, ‘@fr’, ‘@es’ in front of the taxonomy term. If I use some WordPress function to list the taxonomy terms the ‘@**” are filtered out… but everything that gets displayed by the ACF functions show those ‘@**’… Can someone help me on this?
Hmmm, a new page could work. Let’s see!
Thanks!
Or you can also create a regular page called “translations” where you might put all strings in as acf textfields. Then you’ll be able to translate it as usual pages and it’s a bit simpler than creating a whole cpt for a single page 🙂
I usually create three pages when dealing with WPML and ACF; Header, Footer and Global translations. These three act as replacement for having three options-pages with ACF. The upside is that they’re all collected in pages for easy access and you don’t need to create a cpt. The downside is that it’s not really semantically correct since they are not really being used as pages.
Hi @iamntz
The only way for the options page add-on to play nicely with WPML is to create a translation of the field group for each translation.
Each options page field group will need a prefix for the field names. This prefix is the WPML language code (en_, fr_)
A field group for english may have a field called en_twitter, en_headline, etc..
Then, in your template file, you can find the current language code (WPML uses a constant for this, not sure exactly what it is off the top of my head).
Use this language code to generate the field name: eg:
get_field( LANG_CODE . '_twitter', 'options');
I hope that helps.
Your other option is to use a custom post type called options. That way you can use WPML as normal. But instead of using ‘options’ as the second param of get_field, you will need to find the post ID of the optiosn post type object
Dear Eliot, as of now we have chosen not to translate our ACFs, because we are facing some others compatibility issues with our templates, saying that I cannot create a screen cast because we disabled WPML for ACFs – but thanks a lot for getting back to me.
I solved this problem myself.
in /plugins/advanced-custom-fields/core/fields/_functions.php Line: 330
change maybe_unserialize() to unserialize()
before:
$field = maybe_unserialize( $field );
$field = maybe_unserialize( $field ); // run again for WPML
now:
$field = unserialize( $field );
$field = maybe_unserialize( $field ); // run again for WPML
I just had this same issue. No matter which ACF field I created, nothing got saved. I tried opening the default WordPress Custom Fields from Screen Options and those worked ok.
I had pretty much just ACF, ACF repeater and WPML installed on a WP. I ended up clearing the whole database and recreating the few pages I had, which resolved the issue. If you like, I can send you the non-working db-dump.
I have the same versions of wp and acf as PapaBearNZ.
Hi @Athen
It’s difficult for me to understand the issue through writing. Are you able to create a screen cast of the issue?
Thanks,
I also thought so – my problem is: when I translate a custom post type, and go the the “new” edition of the page, I get zero ACF’s on that new page- on the old page I may have 30 ACF’s, but not in the new one. I have all the values of ACF visible for translation at the end of the page, listed as radio buttons where I can those Nothing, Copy, or Translate. I those Translate for every ACF’s, and hit apply. Then, I guess I should have all the original ACF’s ready for translation (input values) but I don’t..?
Thank you so much for you support so far. If anyone has written a kind of how-to on ACF and WPML i would be awesome? 🙂
Unfortunately, ACF has not yet been tested with qTranslate. It does however work well with WPML
Hi @Athen
Yes, ACF is compatible with WPML.
You can translate pages independently to have different custom field values.
Does this solve the question or is there something specific you want to know?
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.