Support

Account

Home Forums Search Search Results for 'WPML'

Search Results for 'WPML'

reply

  • I’m not familiar with WPML and the information here, including solutions to previous questions on WPML and ACF are pretty scarce.

    With that said, if either of you figure this out it would be great if you post the solution. I can’t tell you exactly how to solve this issue but I might be able to help you look for a solution by going over the steps I’d take if I needed to figure this out.

    I took a look at the WPML hook reference https://wpml.org/documentation/support/wpml-coding-api/wpml-hooks-reference/ and found nothing that appears to let you filter the list of fields that should be copied.

    The first thing I’d do is look for a filter of some kind in the WPML code that might possibly let you filter the list of fields to be copied. Most plugins, especially large plugins, have many filters that are not included in any documentation and the only way to find them is to dig around in the code.

    If there isn’t an existing filter then the next step I’d take is to dig around in the database to figure out where the information is stored. Knowing where it’s stored may actually help you find a hook to filter that information.

    With either a hook or knowing where and how the information is stored I would then create an acf/save_post filter. In this filter I would check the repeater fields that you want to duplicate and how many rows they have. I would compare that with the information already stored in WPML and one way or another update that information in the database.

    If you can locate a hook and supply information on it, or you can locate the information and how it’s stored then I can probably help you figure out the ACF side of the equation to update the data.

  • Hi @quirksmode,

    Thanks for the post.

    Each field group within each language will require a translation of the field group and each field will have a unique name with a prefix containing the WPML language code (en_, fr_)

    You can then target the field using the update_field() like so:

    update_field( LANG_CODE . '_twitter',$data, 'options');

    I hope this helps.

  • WPML’s filters for posts_where mess up the acf_get_field_id’s get_posts query somehow so that it can’t get the ID of some fields and then their values won’t save from the front-end form. When I alter the args on the query (change acf_field_key -> name and suppress_filters -> true) it works fine.

  • Hi @noma

    In what way is WPML messing things up for you? ACF is supposed to be compatible with WPML. Even the options pages with a little bit of custom tweaking: https://www.advancedcustomfields.com/resources/multilingual-custom-fields/

    You’re not using WPMLs latest RC/Beta of their new version? Because I don’t think elliot has had the chance to look at that yet.

  • Well, that doesn’t really help me figure out what you need to do. I’m not very familiar with WPML. It’s also not my file. I just help out here on this support forum. However, editing one of the core files of the plugin isn’t usually a good idea, there are plenty of hooks in ACF and there are hooks in WPML as far as I know.

    Here’s an example of getting language independent values from ACF, it’s for options values but it can likely be adapted to use for other things as well. https://gist.github.com/senlin/4fd15ba7a19533ceb9fe

  • thanks for your reply…

    am working ACF with WPML…

    am editing, your file ‘core/ field/text.php’

    for all other language, i want to display english as placeholder

    $english_recipe_id = icl_object_id($arabic_post_id,’recipe’,true,’en’);

    get_field($english_recipe_id,$field[‘name’]);

  • For future reference, I am using WPML and I have added this Relationship field after installing WPML, so I had to went back to WPML > Translation options and hit “Save” on “Custom posts”.

    That’s it, it’s working perfectly. 🙂

  • Hey guys, I created a fix for this. You can install it as a plugin from here:

    https://github.com/iamntz/acf-gallery-wpml-fix

  • Hi @eaglejohn

    I believe the plugin author has added some compatibilities with WPML so they should have a better compatibility. The fact that the field is translated without error shows it.

    The issue you have is weird, though. Could you please check the entries in the database for both master and translated posts? You can check the custom field in the “wp_postmeta” table.

    Also, could you please check this page: https://www.advancedcustomfields.com/resources/multilingual-custom-fields/?

    Thanks!

  • This would help indeed, but it’s not very flexibel if another language will be added to the website. I’m trying to figure out if this is an ACF or WPML bug. I know both plugins weren’t best friends in the past. Maybe they’re not still?

  • Hi @eaglejohn

    I believe you can check the current language by using the ICL_LANGUAGE_CODE constant. This page should give you more idea about it: https://wpml.org/documentation/support/wpml-coding-api/. So, I think you can do it like this:

    if (ICL_LANGUAGE_CODE == 'en') {
        $images = get_field('gallery');
    } else {
        $images = array_reverse( get_field('gallery') );
    }

    Hope this helps 🙂

  • I think I may be on to something, but since I don’t have access to WPML I need you to do something. Below you will find a snippet of code. Add it to your functions.php file. Load an editor page in two different languages and post the field settings for the same tab in two different languages. You will need to view the source of the page in order to see the array that is output.

    
    
    	add_action('acf/render_field', 'render_tab_field');
    	function render_tab_field($field) {
    		if ($field['type'] == 'tab') {
    			echo '<pre>'; print_r($field); echo '</pre>';
    		}
    	}
    
  • Well, I was going to say that you could probably localize your script with the correct field keys depending on the language so that you can target them. I dug through some of the ACF code and I can see where ACF duplicates the field group when WPML is set up, but I can’t figure out how to get the right information, but I don’t know that much about WPML.

    It has something to do with $iclTranslationManagement, is this a global variable in WPML? I’m assuming that it has something do do with it because the function that duplicates the field group is called on the hook 'icl_make_duplicate'

    How is the field key modified? Is it a completely new field key or is something added to the existing field key?

  • Yeah, that’s what I have been doing, but I have found that WPML changes those on the different languages, so other than the main language, that doesn’t work.

    If I could set the class, it would remain constant across the languages (unless the user changes it). I’m sure there would be other use cases for it, but I just know that this would have helped me now 🙂

  • Hello James,
    thank you for your reply.
    I’m sorry I couldn’t come back before.

    I have updated Toolset, ACF and WPML plugins to the latest versions and now it seems to be solved. Now the drag and drop works again. I hope it will work with AVADA version 4.0 recently released. I will wait some time before upgrading anyway.

    Best regards,
    Jean

  • Hi @kmeronuk,

    Thanks for the post.

    This issue looks like it could be stemming from some incorrect configuration in your WPML translation management page. Please note that these settings should be set before you begin creating your field groups.

    I have also noted the use of the get_sub_field() function, is the Relationship field nested within a Repeater field?

  • Hi @belov1988

    Thanks a bundle for the sharing the solution on how to add WPML support to the api

    This will surely help someone else in the same situation.

  • Hi @bjornbjorn,

    Thanks for the post.

    This issue is now resolved, all these shortcomings are now fixed in the version 4.x.x db upgrade script.

    It is also possible to export your WPML settings by saving your WPML tables with prefix ‘wp_icl’, Additionally WPML stores its settings in wp_options table, so you also move the wp_options table too.

  • Hi @sencha

    I’m afraid Polylang is not supported by ACF. If you are using WPML, please take a look at this page to learn more about it: https://www.advancedcustomfields.com/resources/multilingual-custom-fields/.

    Hope this helps 🙂

  • Ok, deinstalled Polylang and installed WPML. Saw no other solution 🙁

  • Hello there

    I’m also interest in MultilingualPress, after bad experiences updating a WordPress site that uses WPML e ACF.

    Did anyone made the both work together, ACF and MultilingualPress?

    Thanks,

    Marlus

  • Hi James,

    let me briefly explain my situation where an option to translate choices would be more than welcome. I use ACF select fields mainly for products (woocommerce). I have a select field for product’s materials:
    – mat_1 : Aluminum
    – mat_2 : Stainless steel
    – mat_3 : Glass and aluminium

    This is for my default English language, but I also need the same choices for Slovenian language.

    But fortunately I’ve found a solution that worked out great:
    First I set all fields to Copy (in Edit Field Group) and Copy from translation to original (in WPML Translation Management/Multilingual Content Setup).
    Then I wrote if ICL_LANGUAGE_CODE != ‘en’ to output translated string from POT file otherwise normally echo get_field().

    Thanks!

  • Hi @hambos22

    I’m not familiar with WPML features and functions, but your function looks great for me. Glad that you solved this issue.

    I hope the others can benefit from your post or suggest a better method id they know 🙂

    Thanks!

  • Hi there,

    Thank you for your reply.
    I just tried exactly your configuration, and still have the same problem … Here are two screenshots, one of the ACF configuration, and the other of the post editing screen. The custom fields just disappear from the post’s backend screen.
    The only way to have them come back, is to change the rule to POST = The Post title.

    I checked the errors, from the browser, I only get warnings. Do you want me to copy them here ? (it’s a long list).
    Also, I tried to desactivate WPML plugin, but the problem stays there.

    Thank you again,
    Cheers,
    Jaad

Viewing 25 results - 151 through 175 (of 495 total)