Yea, unfortunately WPML and ACF works nicely together ONLY if you don’t change “post_id” to something different than “options“, if you want to use something like “sidebars” for example, than translations for your options page stop working and updating options page on other language will overwrite other ones, or I assume it just updates it as not even trying to update for current language and separate from other ones 🙂
I managed to fix this issue like this:
// Get language suffix if not default language
function getTheLang(){
if( function_exists('icl_get_languages')){
global $sitepress;
$default_lang = $sitepress->get_default_language();
$lang = ICL_LANGUAGE_CODE;
if($lang != $default_lang) return '_'.$lang;
}
return '';
}
// Add custom options page
acf_add_options_page(array(
'page_title' => 'Sidebars composer',
'menu_title' => 'Sidebars composer',
'post_id' => 'sidebars' . getTheLang(),
'parent_slug' => 'themes.php',
));
To load a field, just add “getTheLang()” after your custom options “post_id”, like this for example:
get_field( ‘sidebars’, ‘sidebars’ . getTheLang() );
Nut much changed/hacked there, but this is works nicely 🙂
Take a look at this plugin: https://github.com/infazz/flexible-templates
It allows saving of Flexible content templates.
Please note that current version is only able to work with one flexible content on the page. Plugin is fresh and in beta. 🙂
Take a look at this plugin: https://github.com/infazz/flexible-templates
It allows saving of Flexible content templates.
Please note that current version is only able to work with one flexible content on the page. Plugin is fresh and in beta.
Take a look at this plugin: https://github.com/infazz/flexible-templates
It allows saving of Flexible content templates.
Maybe this will be helpful to someone: https://github.com/infazz/flexible-templates
This plugin alows saving of the templates for Flexible Content field, same as for other page builders out there
Also, if someone faces some issues/problems let me 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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.