Support

Account

Home Forums Add-ons Options Page Problem with Creating New Menus?

Solved

Problem with Creating New Menus?

  • I purchased the ACF Options Add-On earlier today. However, I’m a bit stuck with creating new menus and sub-menus.

    I followed the Vimeo video under ‘Overview’ on ‘The Options Page’. Specifically by inserting the following code in the functions.php:

    if( function_exists('acf_add_options_page') ) {
    	
    	acf_add_options_page(array(
    		'page_title' 	=> 'Theme General Settings',
    		'menu_title'	=> 'Theme Settings',
    		'menu_slug' 	=> 'theme-general-settings',
    		'capability'	=> 'edit_posts',
    		'redirect'		=> false
    	));
    	
    	acf_add_options_sub_page(array(
    		'page_title' 	=> 'Theme Header Settings',
    		'menu_title'	=> 'Header',
    		'parent_slug'	=> 'theme-general-settings',
    	));
    	
    	acf_add_options_sub_page(array(
    		'page_title' 	=> 'Theme Footer Settings',
    		'menu_title'	=> 'Footer',
    		'parent_slug'	=> 'theme-general-settings',
    	));
    	
    }

    This code doesn’t appear to be doing anything, so I removed the IF statement and received a PHP error:

    Fatal error: Call to undefined function acf_add_options_page()

    Not sure what I’m doing wrong?

  • Try setting up an action to run your code, this is usually how I add them.

    
    add_action('init', 'add_my_options_pages');
    function add_my_options_pages() {
        // put your code from above in this function
    }
    
  • Hi John.

    Thanks for the speedy reply once again!

    I’ve tried running it through an action/function as recommended above. However, the results still seem to be the same (See screenshot).

    I’m not sure how to proceed?

    Just as an aside, I’m running it on a XAMP local test server, I assume this wouldn’t have any effect on the outcome?

    Thanks!
    Schalk

  • okay, looking back over this you said add on, so that’s acf4. The options pages are a bit different in acf4. You need to use the function acf_add_options_sub_page

    acf_add_options_page did not exist in V4. I can’t seem to locate the documentation related specifically to 4 at the moment.

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

The topic ‘Problem with Creating New Menus?’ is closed to new replies.