$text = Text::create('first_name_one')
->label('First Name')
->ariaLabel('Enter your first name')
->instructions('Please enter your first name, maximum length of 50 characters')
->required(1)
->conditionalLogic(0)
->wrapperWidth(50)
->wrapperClass('first-name')
->wrapperID('first-name')
->maxlength(20)
->placeholder('Your first name')
->prepend('Before input')
->append('After input')
->save();
// var_dump($text);
// die();
add_action( 'acf/include_fields', function() {
if ( ! function_exists( 'acf_add_local_field_group' ) ) {
return;
}
acf_add_local_field_group( array(
'key' => 'group_667ea0e68e',
'title' => 'test_group',
'fields' => array(
Text::create('first_name_one')
->label('First Name')
->ariaLabel('Enter your first name')
->instructions('Please enter your first name, maximum length of 50 characters')
->required(1)
->conditionalLogic(0)
->wrapperWidth(50)
->wrapperClass('first-name-one')
->wrapperID('first-name-one')
->maxlength(20)
->placeholder('Your first name')
->prepend('Before input')
->append('After input')
->save(),
array(
'key' => 'field_668sdfsdcd38d',
'label' => 'Last name',
'name' => 'last_name',
'aria-label' => '',
'type' => 'text',
'instructions' => 'Hello, this is for you to enter your first name',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '50',
'class' => 'first-name',
'id' => 'first-name',
),
'default_value' => 'Brandon Zhang',
'maxlength' => '',
'placeholder' => 'Enter your first name',
'prepend' => 'Before input',
'append' => 'After input',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'movie',
),
),
),
'menu_order' => 0,
'position' => 'normal',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
'show_in_rest' => 0,
) );
} );