| 1 |
<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly. |
| 2 |
|
| 3 |
// |
| 4 |
// Set a unique slug-like ID |
| 5 |
// |
| 6 |
$prefix = '_prefix_profile_options'; |
| 7 |
|
| 8 |
// |
| 9 |
// Create profile options |
| 10 |
// |
| 11 |
CSF::createProfileOptions( $prefix, array( |
| 12 |
'data_type' => 'serialize' |
| 13 |
) ); |
| 14 |
|
| 15 |
// |
| 16 |
// Create a section |
| 17 |
// |
| 18 |
CSF::createSection( $prefix, array( |
| 19 |
'title' => 'Custom Profile Options', |
| 20 |
'fields' => array( |
| 21 |
|
| 22 |
// |
| 23 |
// A text field |
| 24 |
// |
| 25 |
array( |
| 26 |
'id' => 'opt-text', |
| 27 |
'type' => 'text', |
| 28 |
'title' => 'Text', |
| 29 |
), |
| 30 |
|
| 31 |
array( |
| 32 |
'id' => 'opt-textarea', |
| 33 |
'type' => 'textarea', |
| 34 |
'title' => 'Textarea', |
| 35 |
'help' => 'The help text of the field.', |
| 36 |
), |
| 37 |
|
| 38 |
array( |
| 39 |
'id' => 'opt-upload', |
| 40 |
'type' => 'upload', |
| 41 |
'title' => 'Upload', |
| 42 |
), |
| 43 |
|
| 44 |
array( |
| 45 |
'id' => 'opt-switcher', |
| 46 |
'type' => 'switcher', |
| 47 |
'title' => 'Switcher', |
| 48 |
'label' => 'The label text of the switcher.', |
| 49 |
), |
| 50 |
|
| 51 |
array( |
| 52 |
'id' => 'opt-color', |
| 53 |
'type' => 'color', |
| 54 |
'title' => 'Color', |
| 55 |
'default' => '#3498db', |
| 56 |
), |
| 57 |
|
| 58 |
array( |
| 59 |
'id' => 'opt-checkbox', |
| 60 |
'type' => 'checkbox', |
| 61 |
'title' => 'Checkbox', |
| 62 |
'label' => 'The label text of the checkbox.', |
| 63 |
), |
| 64 |
|
| 65 |
array( |
| 66 |
'id' => 'opt-radio', |
| 67 |
'type' => 'radio', |
| 68 |
'title' => 'Radio', |
| 69 |
'options' => array( |
| 70 |
'yes' => 'Yes, Please.', |
| 71 |
'no' => 'No, Thank you.', |
| 72 |
), |
| 73 |
'default' => 'yes', |
| 74 |
), |
| 75 |
|
| 76 |
array( |
| 77 |
'id' => 'opt-select', |
| 78 |
'type' => 'select', |
| 79 |
'title' => 'Select', |
| 80 |
'placeholder' => 'Select an option', |
| 81 |
'options' => array( |
| 82 |
'opt-1' => 'Option 1', |
| 83 |
'opt-2' => 'Option 2', |
| 84 |
'opt-3' => 'Option 3', |
| 85 |
), |
| 86 |
), |
| 87 |
|
| 88 |
) |
| 89 |
) ); |
| 90 |
|