hanamura / acf-util
Utilities for Advanced Custom Fields
Installs: 1 881
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-11-19 03:59:56 UTC
README
Utilities for Advanced Custom Fields.
Sample
AcfUtil\AcfValue
provides simple access to field objects of Advanced Custom Fields.
// initialize AcfValue with field objects for specific post // note: `get_field_objects()` is a buildin function of Advanced Custom Fields $acf_value = new AcfUtil\AcfValue(get_field_objects($id)); // access field $value = $acf_value->field_name; // access repeater field $value = $acf_value->repeater_field_name; foreach (var $acf_value->repeater_field_name as $repeater_field) { // child field is also AcfValue object $value = $repeater_field->field_name; // deeper repeater fields are accessible foreach (var $repeater_field->deeper_repeater_field_name as $deeper_repeater_field) { // this is also AcfValue object $value = $deeper_repeater_field->field_name; } }
Requirements
WordPress and Advanced Custom Fields plugin.
License
MIT