Home › Forums › General Issues › Options page + polylang › Reply To: Options page + polylang
Thanks @wube your solution worked great for me. I’ve expanded it a little bit more to have these option pages:
– Global Options (options same for all languages, e.g., social profile links)
– Options (EN) (options specific to English language)
– Options (IT) (options specific to Italian language)
…
/**
* ACF Options Page
*/
if ( function_exists( 'acf_add_options_page' ) ) {
// Main Theme Settings Page
$parent = acf_add_options_page( array(
'page_title' => 'Theme General Settings',
'menu_title' => 'Theme Settings',
'redirect' => 'Theme Settings',
) );
//
// Global Options
// Same options on all languages. e.g., social profiles links
//
acf_add_options_sub_page( array(
'page_title' => 'Global Options',
'menu_title' => __('Global Options', 'text-domain'),
'menu_slug' => "acf-options",
'parent' => $parent['menu_slug']
) );
//
// Language Specific Options
// Translatable options specific languages. e.g., social profiles links
//
$languages = array( 'it', 'en' );
foreach ( $languages as $lang ) {
acf_add_options_sub_page( array(
'page_title' => 'Options (' . strtoupper( $lang ) . ')',
'menu_title' => __('Options (' . strtoupper( $lang ) . ')', 'text-domain'),
'menu_slug' => "options-${lang}",
'post_id' => $lang,
'parent' => $parent['menu_slug']
) );
}
}
Gist: https://gist.github.com/zeshanshani/60bdf497bcae87bd3a8b03920cf64fc6
And just like @philby mentioned, you can set an option group to show on all language specific option pages.
Hope it helps someone looking for the complete solution. 🙂
@alchemistics I tried the plugin, it indeed works, but a bit buggy as in initial stages I assume. For example, when you select to show all languages, the options page is empty again so could confusing for normal users.
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.