mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php
function my_fields( $fields ) {

// Register a new field group
$fields[‘my_field_group’] = array(
‘label’ => ‘My Field Group’,
‘fields’ => array(
‘test-field’ => array(
‘label’ => ‘Test Field’,
‘type’ => ‘text’,
‘placeholder’ => ‘My placeholder’
)
),
‘rules’ => array(
‘post_types’ => array( ‘post’, ‘page’ )
)
);

// Add a field to an existing group
$fields[‘my_field_group’][‘fields’][‘my_dropdown’] = array(
‘label’ => ‘My Dropdown’,
‘type’ => ‘dropdown’
);

return $fields;
}
add_filter( ‘cfs_fields’, ‘my_fields’ );
{{/gist}}