oont-contents/plugins/pre-orders-for-woocommerce/includes/codestar-framework/samples/profile-options.php
2025-02-08 15:10:23 +01:00

89 lines
1.8 KiB
PHP

<?php if ( ! defined( 'ABSPATH' ) ) { die; } // Cannot access directly.
//
// Set a unique slug-like ID
//
$prefix = '_prefix_profile_options';
//
// Create profile options
//
CSF::createProfileOptions( $prefix, array(
'data_type' => 'serialize'
) );
//
// Create a section
//
CSF::createSection( $prefix, array(
'title' => 'Custom Profile Options',
'fields' => array(
//
// A text field
//
array(
'id' => 'opt-text',
'type' => 'text',
'title' => 'Text',
),
array(
'id' => 'opt-textarea',
'type' => 'textarea',
'title' => 'Textarea',
'help' => 'The help text of the field.',
),
array(
'id' => 'opt-upload',
'type' => 'upload',
'title' => 'Upload',
),
array(
'id' => 'opt-switcher',
'type' => 'switcher',
'title' => 'Switcher',
'label' => 'The label text of the switcher.',
),
array(
'id' => 'opt-color',
'type' => 'color',
'title' => 'Color',
'default' => '#3498db',
),
array(
'id' => 'opt-checkbox',
'type' => 'checkbox',
'title' => 'Checkbox',
'label' => 'The label text of the checkbox.',
),
array(
'id' => 'opt-radio',
'type' => 'radio',
'title' => 'Radio',
'options' => array(
'yes' => 'Yes, Please.',
'no' => 'No, Thank you.',
),
'default' => 'yes',
),
array(
'id' => 'opt-select',
'type' => 'select',
'title' => 'Select',
'placeholder' => 'Select an option',
'options' => array(
'opt-1' => 'Option 1',
'opt-2' => 'Option 2',
'opt-3' => 'Option 3',
),
),
)
) );