• Sorry if I missed an answer elsewhere, but I can see others have had similar problems to mine, but I cannot find examples of an Advanced Custom Fields json config entry to work with.

    I am converting a website to multilingual and the site has an ACF options page. Reading through the other support topics I’ve tried to put together my own wpm-config.json file, but nothing appears to be working and I hope you can put me right. Here is the json at the moment:

    
    {
      "admin_pages": [
        "acf_options_site_fields"
      ],
      "options": {
          "footer_partner_title": {},
          "footer_partner_text": {}
      }
    }
    

    I’m obviously doing something very wrong, but I do not know what! I hope you can help!

Viewing 14 replies - 1 through 14 (of 14 total)
  • Thread Starter spoonofmilk

    (@spoonofmilk)

    In case it helps, here is the options page I am trying to make multi-language:

    wp-admin/admin.php?page=acf-options-site-fields (I’ve tried hypenated and underscored in the admin_pages bit)

    View post on imgur.com

    Hi @spoonofmilk
    If You are using ACF, You do not need to add configuration for ACF to config file.
    You need to add screen ID for current screen (not a page slug) in ‘admin_pages’ section.

    I too am having an issue figuring this out.

    Here is my options page code

    acf_add_options_sub_page(array(
            'page_title'    => 'Theme Header Settings',
            'menu_title'    => 'Header',
            'parent_slug'    => 'theme-general-settings',
        ));

    I tried adding the “post_id” parameter and giving it an obscure number (9256), then adding this to my config file

    {
      "admin_pages": [
        9256
      ],
    }
    

    No luck.

    @jordanwebdev
    You need to find out the screen ID in the current admin screen. It available in WP_Screen object.

    @valexar

    I used get_current_screen, but it gives me back a string, not an int.

    [“id”]=> string(36) “toplevel_page_theme-general-settings”

    Here is my wpm-config.json file, located in the theme root ( tried for my nav menus, too)

    {
      "admin_pages": [
        "toplevel_page_theme-general-settings",
        "nav-menus",
      ],
    }

    No luck on either page. To make things worse, ACF is now not working on the edit menu page, unless I deactivate the plugin.

    • This reply was modified 6 years, 9 months ago by jordanwebdev.
    • This reply was modified 6 years, 9 months ago by jordanwebdev.

    @jordanwebdev
    ID for admin screen always is a string.
    Why You added “nav-menus” to config? There is already a language switcher.
    What version of ACF? What fields do you use? Where exactly are you using these fields? In the menu item or the entire menu?

    @valexar

    I added “nav-menus” because ACF was not working on my menu page unless I disabled this plugin, so I thought maybe I had to update the config file to make it work.

    I use the latest PRO version of ACF. I am trying to add an image uploader to menu items. It works fine when I deactivate WP Multilang but with the plugin active, I don’t see the uploader in the menu items.

    Thank You. I found the bug. It will be fixed in next version.

    You’re welcome. Sorry to bring this up again, but I’m still unable to get my options page working. I have a text field on there (as well as some other fields), and not even the text field is translatable.

    Here’s my basic wpm-config.json file, which is located in my theme’s root.

    {
      "admin_pages": [
        "theme-settings_page_acf-options-footer",
      ],
    }

    I got that ID displayed by putting the following in functions.php

    function id_WPSE_114111() {
        var_dump(get_current_screen());
    }
    
    add_action( 'admin_notices', 'id_WPSE_114111' );
    • This reply was modified 6 years, 9 months ago by jordanwebdev.
    • This reply was modified 6 years, 9 months ago by jordanwebdev.
    • This reply was modified 6 years, 9 months ago by jordanwebdev.

    Hi @jordanwebdev
    On the page ‘theme-settings_page_acf-options-footer’ exist language switcher?

    I do not see the language switcher. I only see the generic one in the wp-admin, but that does not appear to be what I need here. I need to fill those ACF fields in multiple languages.

    View post on imgur.com

    At the top, you can see the screen object is outputted.

    Peter

    (@digitalform)

    Hi!

    I put this code into the .json file:
    {
    “admin_pages”: [
    “toplevel_page_theme-special-settings”,
    ],
    }

    And there is not language switcher. ??

    Hi @digitalform
    You need to get the page id from ‘get_current_screen()’ in admin.

    Peter

    (@digitalform)

    Hi VaLeXaR,

    The ACF Options page id is 12810 (or toplevel_page_theme-special-settings). But the language switcher isn’t in the ACF Options page?

    My code:

    {
    “admin_pages”: [
    12810,
    “toplevel_page_theme-special-settings”
    ],
    },

    • This reply was modified 6 years, 8 months ago by Peter.
Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘ACF Options page config’ is closed to new replies.