Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
wp-content
/
plugins
/
advanced-custom-fields
/
includes
/
fields
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php if (!class_exists('acf_field_url')) { class acf_field_url extends acf_field { function initialize() { $this->name = 'url'; $this->label = __('Url', 'acf'); $this->defaults = array('default_value' => '', 'placeholder' => ''); } function render_field($field) { $atts = array(); $keys = array('type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern'); $keys2 = array('readonly', 'disabled', 'required'); $html = ''; foreach ($keys as $k) { if (isset($field[$k])) { $atts[$k] = $field[$k]; } } foreach ($keys2 as $k) { if (!empty($field[$k])) { $atts[$k] = $k; } } $atts = acf_clean_atts($atts); $html .= '<div class="acf-input-wrap acf-url">'; $html .= '<i class="acf-icon -globe -small"></i>' . acf_get_text_input($atts); $html .= '</div>'; echo $html; } function render_field_settings($field) { acf_render_field_setting($field, array('label' => __('Default Value', 'acf'), 'instructions' => __('Appears when creating a new post', 'acf'), 'type' => 'text', 'name' => 'default_value')); acf_render_field_setting($field, array('label' => __('Placeholder Text', 'acf'), 'instructions' => __('Appears within the input', 'acf'), 'type' => 'text', 'name' => 'placeholder')); } function validate_value($valid, $value, $field, $input) { if (empty($value)) { return $valid; } if (strpos($value, '://') !== false) { } elseif (strpos($value, '//') === 0) { } else { $valid = __('Value must be a valid URL', 'acf'); } return $valid; } } acf_register_field_type('acf_field_url'); }