Support

Account

Home Forums ACF PRO Options Page And Menu

Solved

Options Page And Menu

  • Hi All:

    Trying out ACF5 and been at it for about two hours. Extremely frustrated trying to add a Theme Options menu with sub menu items.

    I have been through all the documentation and tried every permutation I can think of. Can some one help me get started.

    In the past (ACF4 + addon) I used something like this with much success:

    function my_acf_options_page_settings($settings) { // ---- Adds Options	
    	$settings['title'] = 'Theme Options';
    	$settings['pages'] = array('Popular Posts','Testimonials','Videos');
    	return $settings;	
    }
    add_filter('acf/options_page/settings', 'my_acf_options_page_settings');
    

    I don’t seem to be able to do something similar any longer. Greatly appreciated if some one can share a working code snippet to get this done.

    Best Regards,
    John

  • ACF5 no longer adds the default options page that you’re used to be added to the admin menu. If that’s the option page you’re trying to alter the settings of then you have to switch to acf_add_options_page() (http://www.advancedcustomfields.com/resources/acf_add_options_page/) or acf_add_options_sub_page() (http://www.advancedcustomfields.com/resources/acf_add_options_sub_page/)

  • Thanks – I understand that the code that I posted will no longer work. But I am looking for the code that will produce the same effect.

    I tried to use the information in both those pages several times, as mentioned two-hours of experimentation and can’t seem to get it to work.

    This is what I am trying to achieve:
    http://screencast.com/t/wuzQoV0csz2W

    Any help?

  • Something like this would do it

    add_action('admin_menu', 'add_options_pages');
    function add_options_pages() {
      if (!function_exists('acf_add_options_page')) {
        return;
      }
      acf_add_options_page(array('page_title' => 'Theme Options'));
      // the following parent url will be auto generated by the above call
      // you can change the slug by specifying a slug for the page
      $parent = 'acf-options-theme-options';
      $sub_options_pages = array('Header', 'Navigation', 'Banner', 'Etc');
      foreach ($sub_options_pages as $title) {
        acf_add_options_sub_page(array('title' => $title, 'parent' => $parent));
      }
    }

    edited, didn’t need $options_page = on this line acf_add_options_page(array('page_title' => 'Theme Options'));'

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

The topic ‘Options Page And Menu’ is closed to new replies.