Support

Account

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.