Adding Post Options

Modify your post/custom post type with brand new settings

WordPress powered with Post Type meta boxes. Add Meta Box to the desired post type with a unique ID.

add_filter('stm_wpcfto_boxes', function ($boxes) {

    $boxes['my_metabox'] = array(
        'post_type' => array('post', 'my-custom-post-type'),
        'label' => esc_html__('Post settings', 'my-domain'),
    );

    return $boxes;
});

And we need to add fields to this Meta Box:

add_filter('stm_wpcfto_fields', function ($fields) {

    $fields['my_metabox'] = array(

        'tab_1' => array(
            'name' => esc_html__('Field Settings', 'my-domain'),
            'fields' => array(
                'field_1' => array(
                    'type' => 'text',
                    'label' => esc_html__('Field text', 'my-domain'),
                ),
            )
        ),

    );

    return $fields;
});

Custom Fields

You can easily use default WordPress functions such as get_post_meta(), get_option() or get_term_meta(). But for the option we built-in function to get any param you want:

$options = stm_wpcfto_get_options('my_awesome_settings');

Last updated