Support

Account

Home Forums Feature Requests Options Pages – Menu items for each

Solving

Options Pages – Menu items for each

  • Hi Elliot,

    Currently the Options Pages system works by putting every Options page that is set up into a sub-menu underneath the top-level Options menu item. This may be ok for sites that have 1 options page, but on many of mine I have in the region of 5-10, all categorised into different functions.

    I change the ACF code every time I upgrade but it’d be nice to see this as a configurable option, so the user can implement by:

    <? register_options_page('various_options',true); ?>
    And then have the default as false (so the options pages are displayed as sub menu items are normal, rather than top level menu items).

    You obviously know this Elliot but if anyone stumbles across this and it doesn’t get implemented, you change:

    Start by commenting out acf-options-page.php Line 156
    $parent_page = add_menu_page($parent_title, $parent_menu, $this->settings['capability'], $parent_slug, array($this, 'html'));
    becomes
    //$parent_page = add_menu_page($parent_title, $parent_menu, $this->settings['capability'], $parent_slug, array($this, 'html'));

    Change acf-options-page.php on Line 171:
    $child_page = add_submenu_page($parent_slug, $sub_title, $sub_title, $this->settings['capability'], $sub_slug, array($this, 'html'));
    to
    $child_page = add_menu_page($sub_title, $sub_title, 'edit_posts', $sub_slug, array($this, 'html'), $icon_url);

  • Thanks for the code!

    Lookign forward, what would be the best way to integrate this into the options page?

    Do you think a filter to enable / disable the options page parent?

  • In fact a configurable option in Custom Fields -> Settings would probably make the most sense. And default it to sub-menus for all existing users 🙂

  • Erm, I just realised Custom Fields -> Settings doesn’t exist.

    Time for bed.

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Options Pages – Menu items for each’ is closed to new replies.

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.