Support

Account

Home Forums Add-ons Options Page Adding Multiple Option Page

Solved

Adding Multiple Option Page

  • Whats wrong with this code? Im trying to add Multiple Option Page.
    Please advice…do u have any sample code for this?

    add_filter(‘acf/options_page/settings’,’my_options_page_settings’);

    function my_options_page_settings( $options )
    {
    $options[‘title’] = __(‘Options’);
    $options[‘pages’] = array(
    __(‘Contact Information’),
    __(‘Carousel Slider’)

    );
    }

  • Hi @quincypabotoy

    Hmmm… your code looks fine, but it’s not working?

    Strange. Can you try this function instead:
    http://www.advancedcustomfields.com/resources/functions/acf_add_options_sub_page/

    Thanks
    E

  • Thanks elliot,

    This is exactly what it looks on my function.php

    include_once(‘/acf-options-page/acf-options-page.php’);

    add_filter(‘acf/options_page/settings’,’my_options_page_settings’);

    function my_options_page_settings( $options )
    {
    $options[‘title’] = __(‘Options’);
    $options[‘pages’] = array(
    __(‘Contact Information’),
    __(‘Carousel Slider’)

    );
    }

    And also this is the code u suggested (function.php)

    include_once(‘/acf-options-page/acf-options-page.php’);

    if( function_exists(‘acf_add_options_sub_page’) )
    {
    acf_add_options_sub_page(array(
    ‘title’ => ‘Footer’,
    ‘parent’ => ‘options-general.php’,
    ‘capability’ => ‘manage_options’
    ));
    }

    ——————–

    Both return an error… Forgive me if i’m too damn for doing this code.. Im a Front-end / Graphic Designer.

  • Hi there, I had a similar problem. Are you putting the code into your theme’s function.php rather than the core wordpress function.php?

  • hi Silveredge, yes its a function.php which is inside my theme directory…

    Maybe thats the problem?

  • Hi @quincypabotoy

    Can you confirm that the options page add-on is being correctly included?

    the code:
    include_once(‘/acf-options-page/acf-options-page.php’);

    suggests that the add-on is in the root of your server. Is this correct?

  • hmm, the folder which contain the acf-option-page.php is inside my theme (themes/mytheme/acf-option-page) and the code (include_once(‘/acf-options-page/acf-options-page.php’);) is place in my function.php (themes/mytheme/function.php).

    thanks

  • Hi @quincypabotoy

    Thanks for the info. Yes, your code is pointing to the wrong path.
    Just remove the initial / to make the path relative instead of absolute

  • it works! also this code works!

    if( function_exists(‘acf_add_options_sub_page’) )
    {
    acf_add_options_sub_page( ‘Header’ );
    }

  • I’m struggling to follow the settings functions for the options page.
    I want to add multiple pages which is fine but is it possible to set a single option page to only be accessed by admin?

  • Hi @cocomitte

    You can use the acf_add_options_sub_page function to add extra options pages.
    Each options page added can contain more data than just a title, it can also contain a ‘capability’:

    http://www.advancedcustomfields.com/resources/functions/acf_add_options_sub_page/

    You can also modify the parent capability to set strict permissions on the default menu page:
    http://www.advancedcustomfields.com/resources/functions/acf_set_options_page_capability/

    Thanks
    E

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

The topic ‘Adding Multiple Option Page’ is closed to new replies.