Last active
January 16, 2021 10:22
-
-
Save alanpilloud/58e980f614b3216f47425abf9e50e53a to your computer and use it in GitHub Desktop.
PHP ACF Fields
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'checkbox', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'choices' => [ | |
], | |
'allow_custom' => 0, | |
'save_custom' => 0, | |
'default_value' => [ | |
], | |
'layout' => 'vertical', | |
'toggle' => 0, | |
'return_format' => 'value', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'clone', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'clone' => '', | |
'display' => 'seamless', | |
'layout' => 'block', | |
'prefix_label' => 0, | |
'prefix_name' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'color_picker', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'date_picker', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'display_format' => 'd/m/Y', | |
'return_format' => 'd/m/Y', | |
'first_day' => 1, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'date_time_picker', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'display_format' => 'd/m/Y g:i a', | |
'return_format' => 'd/m/Y g:i a', | |
'first_day' => 1, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'email', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'placeholder' => '', | |
'prepend' => '', | |
'append' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'file', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'return_format' => 'array', | |
'library' => 'all', | |
'min_size' => '', | |
'max_size' => '', | |
'mime_types' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'gallery', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'min' => '', | |
'max' => '', | |
'insert' => 'append', | |
'library' => 'all', | |
'min_width' => '', | |
'min_height' => '', | |
'min_size' => '', | |
'max_width' => '', | |
'max_height' => '', | |
'max_size' => '', | |
'mime_types' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'google_map', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'center_lat' => '', | |
'center_lng' => '', | |
'zoom' => '', | |
'height' => '', | |
], | |
// ... | |
// In order to use this field, you must add you Google API Key. You might want to replace the GMAPAPIKEY constant with your own key. | |
/** | |
* Register API Key for ACF Google maps | |
*/ | |
add_filter('acf/fields/google_map/api', function ($api) { | |
$api['key'] = GMAP_API_KEY; | |
return $api; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'group', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'layout' => 'block', | |
'sub_fields' => [ | |
], | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'image', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'return_format' => 'array', | |
'preview_size' => 'thumbnail', | |
'library' => 'all', | |
'min_width' => '', | |
'min_height' => '', | |
'min_size' => '', | |
'max_width' => '', | |
'max_height' => '', | |
'max_size' => '', | |
'mime_types' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'link', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'return_format' => 'array', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'message', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'message' => '', | |
'new_lines' => 'wpautop', | |
'esc_html' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
'key' => 'field_[group_name]_[field_name]', | |
'name' => '[group_name]_[field_name]', | |
... | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'number', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'placeholder' => '', | |
'prepend' => '', | |
'append' => '', | |
'min' => '', | |
'max' => '', | |
'step' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'oembed', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'width' => '', | |
'height' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'page_link', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'post_type' => [ | |
], | |
'taxonomy' => [ | |
], | |
'allow_null' => 0, | |
'allow_archives' => 1, | |
'multiple' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'password', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'placeholder' => '', | |
'prepend' => '', | |
'append' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'post_object', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'post_type' => [ | |
], | |
'taxonomy' => [ | |
], | |
'allow_null' => 0, | |
'multiple' => 0, | |
'return_format' => 'object', | |
'ui' => 1, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'radio', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'choices' => [ | |
], | |
'allow_null' => 0, | |
'other_choice' => 0, | |
'save_other_choice' => 0, | |
'default_value' => '', | |
'layout' => 'vertical', | |
'return_format' => 'value', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'relationship', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'post_type' => [ | |
], | |
'taxonomy' => [ | |
], | |
'filters' => [ | |
0 => 'search', | |
1 => 'post_type', | |
2 => 'taxonomy', | |
], | |
'elements' => '', | |
'min' => '', | |
'max' => '', | |
'return_format' => 'object', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'repeater', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'collapsed' => '', | |
'min' => 0, | |
'max' => 0, | |
'layout' => 'table', | |
'button_label' => '', | |
'sub_fields' => [ | |
// Write your other fields here | |
[ | |
'key' => 'field_subfield_example', | |
'label' => 'Subfield Example', | |
'name' => 'subfield_example', | |
'type' => 'text', | |
] | |
], | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
'key' => 'field_5981dad47e18f', | |
'name' => 'text', | |
'label' => 'My text field', | |
'type' => 'text', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'select', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'choices' => [ | |
], | |
'default_value' => [ | |
], | |
'allow_null' => 0, | |
'multiple' => 0, | |
'ui' => 0, | |
'ajax' => 0, | |
'return_format' => 'value', | |
'placeholder' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'tab', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'placement' => 'top', | |
'endpoint' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'taxonomy', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'taxonomy' => 'category', | |
'field_type' => 'checkbox', | |
'allow_null' => 0, | |
'add_term' => 1, | |
'save_terms' => 0, | |
'load_terms' => 0, | |
'return_format' => 'id', | |
'multiple' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'text', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'placeholder' => '', | |
'prepend' => '', | |
'append' => '', | |
'maxlength' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'textarea', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'placeholder' => '', | |
'maxlength' => '', | |
'rows' => '', | |
'new_lines' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'time_picker', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'display_format' => 'g:i a', | |
'return_format' => 'g:i a', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'true_false', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'message' => '', | |
'default_value' => 0, | |
'ui' => 0, | |
'ui_on_text' => '', | |
'ui_off_text' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'url', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'placeholder' => '', | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'user', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'role' => '', | |
'allow_null' => 0, | |
'multiple' => 0, | |
], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
// Don't forget required attributes 'key', 'name' and 'label' | |
'type' => 'wysiwyg', | |
'instructions' => '', | |
'required' => 0, | |
'conditional_logic' => 0, | |
'wrapper' => [ | |
'width' => '', | |
'class' => '', | |
'id' => '', | |
], | |
'default_value' => '', | |
'tabs' => 'all', | |
'toolbar' => 'full', | |
'media_upload' => 1, | |
'delay' => 0, | |
], |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment