• Resolved Zain Sohail

    (@zainsohail19)


    Hello guys

    I need to create nested fields in one field. Just similar to query_args,

    $meta_boxes[] = array(
        'id'       => 'select_post',
        'title'    => 'Post Selector',
        'pages'    => array( 'post', 'page' ),
        'context'  => 'normal',
        'priority' => 'high',
    
        'fields' => array(
            array(
                'name'  => 'Post',
                'desc'  => 'My Post Dropdown',
                'id'    => 'my_post_dropdown',
                'type'  => 'post',
                'query_args' => array(
                	'tax_query' => array(
                		array(
                			'taxonomy' => 'category',
                			'field'	=> 'slug',
                			'terms' => 'technology'
                		)
                	)
                )
            ),
        )
    );

    Like the code above this field would include a nested array with a text field and a simple checkbox. Also this field would be cloneable, I have been trying to get this done by creating a custom field but I always face a problem.

    The ideal working state would be something like,

    array(
                    'name'       => 'Resume',
                    'desc'       => '',
                    'id'         => $prefix . 'resume_field',
                    'tab'        => 'resume',
                    'clone'      => true,
                    'sort_clone' => true,
                    'nested_fields'     =>
                        array(
                            'name'       => 'Text',
                            'desc'       => '',
                            'id'         => $prefix . 'resume_text',
                            'type'       => 'text',
                            'class'      => '',
                            'size'       => '170',
                            'columns'    => 12,
                        ),
                        array(
                            'name'       => 'Header',
                            'desc'       => '',
                            'id'         => $prefix . 'resume_header',
                            'type'       => 'checkbox',
                            'class'      => '',
                            'columns'    => 12,
                            'tab'        => 'resume'
                        )
                ),

    Can someone here please help me?

    Thanks,
    Zain

    https://ww.wp.xz.cn/plugins/meta-box/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Create Nested Fields’ is closed to new replies.