Alchemy Options Docs
v0.9
v0.9
  • Read Me
  • Installation
  • Configuration
  • Meta Boxes
  • Theme mode
  • Samples
  • Field types
    • Text
    • Password
    • URL
    • Email
    • Tel
    • Textarea
    • Editor (WYSIWYG)
    • Datepicker
    • Image upload
    • Radio buttons
    • Select
    • Checkbox
    • Colorpicker
    • Image radio
    • Post type select
    • Datalist
    • Sections
    • Repeater
    • Button group
    • Slider
    • Taxonomy select
    • Field group
  • Functions
    • alch_options_id
    • alch_network_options_id
    • alch_get_option
    • alch_get_network_option
    • alch_delete_value
    • alch_get_post_meta
  • Javascript
    • getOption
    • getNetworkOption
    • getPostMeta
  • Filters
    • alch_options_id
    • alch_network_options_id
    • alch_options_id() . '_args'
    • alch_network_options_id() . '_args'
    • alch_allowed_editor_html_tags
    • alch_allowed_editor_protocols
    • alch_value_{ $optionID }
    • alch_network_value_{ $optionID }
Powered by GitBook
On this page

Configuration

PreviousInstallationNextMeta Boxes

Last updated 4 years ago

Make sure you've installed Alchemy Options either as a or as . Then add a function to the init hook in your functions.php. are available for a quick copy and paste.

function add_custom_options() {
    if( ! class_exists( 'Alchemy_Options\Includes\Options' ) || wp_doing_ajax() ) {
        return;
    }

    $options = array(
        'options' => array(
            /* options will go here */
        ),
    );

    new Alchemy_Options\Includes\Options( $options );
}

add_action( 'init', 'add_custom_options' );

That's it, just add instead of /* options will go here */ and see them appear on the Alchemy Options page.

Grouping

If there's a need to split options into several groups, Alchemy Options has got you covered. You may add the tabs section to the config that looks like this:

...
'tabs' => array(
    'tab-one-id' => array(
        'title' => 'Tab one'
    ),
    'tab-two-id' => array(
        'title' => 'Tab two'
    ),
)
...

Keys of the tabs array should be unique, these values will be used in configuring of each option with the tab key. If no tab key is found in each option's settings it will be rendered in each tab.

Thus, the $options variable from above will look like this:

...
$options = array(
    'tabs' => array(
        'tab-one-id' => array(
            'title' => 'Tab one'
        ),
        'tab-two-id' => array(
            'title' => 'Tab two'
        ),
    ),
    'options' => array(
      /* options will go here */
    )
);
...

If there's a need to split options even further, there's a type for visual splitting of fields into togglable sections and a type to group related fields together for an easier .

sections
field-group
value retrieval
Sample configuration objects
some options
plugin
part of your theme