Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 1.11 KB

meta-boxes.md

File metadata and controls

36 lines (28 loc) · 1.11 KB

Meta Boxes

Alchemy Options fields can be used in Meta Boxes. Please take a look at the following configuration example.

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

    $meta_boxes = array(
        array(
            'id' => 'meta_box',
            'title' => 'Meta box title',
            'post-types' => array( 'page' ),
            'meta' => array(
                'options' => array(),
            ),
        ),
    );

    new Alchemy_Options\Includes\Meta_Boxes( $meta_boxes );
}

add_action( 'init', 'add_custom_meta_boxes' );

Params

Name Type Description
id string Unique ID (required)
title string Shows a heading on the meta box (required)
post-types array A list of post types where this meta box should appear (required)
meta array A list of meta options. Should have the options array containing regular options signatures (required)