Function Reference: geodir_custom_fields
Summary
Returns the array of custom fields that can be used.
Package
GeoDirectory
Change Log
Since: 1.6.6
Filters
‘geodir_custom_fields’ [Line: 688]
Source File
geodir_custom_fields() is located in geodirectory-admin/admin_hooks_actions.php [Line: 553]
Source Code
function geodir_custom_fields($post_type=''){
$custom_fields = array(
'text' => array(
'field_type' => 'text',
'class' => 'gd-text',
'icon' => 'fa fa-minus',
'name' => __('Text', 'geodirectory'),
'description' => __('Add any sort of text field, text or numbers', 'geodirectory')
),
'datepicker' => array(
'field_type' => 'datepicker',
'class' => 'gd-datepicker',
'icon' => 'fa fa-calendar',
'name' => __('Date', 'geodirectory'),
'description' => __('Adds a date picker.', 'geodirectory')
),
'textarea' => array(
'field_type' => 'textarea',
'class' => 'gd-textarea',
'icon' => 'fa fa-bars',
'name' => __('Textarea', 'geodirectory'),
'description' => __('Adds a textarea', 'geodirectory')
),
'time' => array(
'field_type' => 'time',
'class' => 'gd-time',
'icon' => 'fa fa-clock-o',
'name' => __('Time', 'geodirectory'),
'description' => __('Adds a time picker', 'geodirectory')
),
'checkbox' => array(
'field_type' => 'checkbox',
'class' => 'gd-checkbox',
'icon' => 'fa fa-check-square-o',
'name' => __('Checkbox', 'geodirectory'),
'description' => __('Adds a checkbox', 'geodirectory')
),
'phone' => array(
'field_type' => 'phone',
'class' => 'gd-phone',
'icon' => 'fa fa-phone',
'name' => __('Phone', 'geodirectory'),
'description' => __('Adds a phone input', 'geodirectory')
),
'radio' => array(
'field_type' => 'radio',
'class' => 'gd-radio',
'icon' => 'fa fa-dot-circle-o',
'name' => __('Radio', 'geodirectory'),
'description' => __('Adds a radio input', 'geodirectory')
),
'email' => array(
'field_type' => 'email',
'class' => 'gd-email',
'icon' => 'fa fa-envelope-o',
'name' => __('Email', 'geodirectory'),
'description' => __('Adds a email input', 'geodirectory')
),
'select' => array(
'field_type' => 'select',
'class' => 'gd-select',
'icon' => 'fa fa-caret-square-o-down',
'name' => __('Select', 'geodirectory'),
'description' => __('Adds a select input', 'geodirectory')
),
'multiselect' => array(
'field_type' => 'multiselect',
'class' => 'gd-multiselect',
'icon' => 'fa fa-caret-square-o-down',
'name' => __('Multi Select', 'geodirectory'),
'description' => __('Adds a multiselect input', 'geodirectory')
),
'url' => array(
'field_type' => 'url',
'class' => 'gd-url',
'icon' => 'fa fa-link',
'name' => __('URL', 'geodirectory'),
'description' => __('Adds a url input', 'geodirectory')
),
'html' => array(
'field_type' => 'html',
'class' => 'gd-html',
'icon' => 'fa fa-code',
'name' => __('HTML', 'geodirectory'),
'description' => __('Adds a html input textarea', 'geodirectory')
),
'file' => array(
'field_type' => 'file',
'class' => 'gd-file',
'icon' => 'fa fa-file',
'name' => __('File Upload', 'geodirectory'),
'description' => __('Adds a file input', 'geodirectory')
)
);
/**
* Filter the custom fields array to be able to add or remove items.
*
* @since 1.6.6
*
* @param array $custom_fields {
* The custom fields array to be filtered.
*
* @type string $field_type The type of field, eg: text, datepicker, textarea, time, checkbox, phone, radio, email, select, multiselect, url, html, file.
* @type string $class The class for the field in backend.
* @type string $icon Can be font-awesome class name or icon image url.
* @type string $name The name of the field.
* @type string $description A short description about the field.
* @type array $defaults {
* Optional. Used to set the default value of the field.
*
* @type string data_type The SQL data type for the field. VARCHAR, TEXT, TIME, TINYINT, INT, FLOAT, DATE
* @type int decimal_point limit if using FLOAT data_type
* @type string admin_title The admin title for the field.
* @type string site_title This will be the title for the field on the frontend.
* @type string admin_desc This will be shown below the field on the add listing form.
* @type string htmlvar_name This is a unique identifier used in the HTML, it MUST NOT contain spaces or special characters.
* @type bool is_active If false the field will not be displayed anywhere.
* @type bool for_admin_use If true then only site admin can see and edit this field.
* @type string default_value The default value for the input on the add listing page.
* @type string show_in The locations to show in. [detail],[moreinfo],[listing],[owntab],[mapbubble]
* @type bool is_required If true the field will be required on the add listing page.
* @type string option_values The option values for select and multiselect only
* @type string validation_pattern HTML5 validation pattern (text input only by default).
* @type string validation_msg HTML5 validation message (text input only by default).
* @type string required_msg Required warning message.
* @type string field_icon Icon url or font awesome class.
* @type string css_class Field custom css class for field custom style.
* @type bool cat_sort If true the field will appear in the category sort options, if false the field will be hidden, leave blank to show option.
* @type bool cat_sort If true the field will appear in the advanced search sort options, if false the field will be hidden, leave blank to show option. (advanced search addon required)
* }
* }
* @param string $post_type The post type requested.
*/
return apply_filters('geodir_custom_fields',$custom_fields,$post_type);
}