-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Fields
Michael Fitzpatrick-Ruth edited this page Dec 28, 2015
·
4 revisions
#Custom Fields
##API Functions
#####get_customfields( $load_fresh = false );
load_fresh
will force the function go fetch the fields remotely.
If false, this function first looks for custom fields in $this->customfields, and then wordpress transient wp_sg_api_customfields
if $this->cache is any positive integer.
argument | required? | datatype |
---|---|---|
load_fresh | no | bool |
Returns false or array of custom fields. |
#####create_field( $name, $display, $type, $allow_other = false );
argument | required? | datatype |
---|---|---|
name | yes | string |
display | yes | string |
type | yes | string ( select | radio | checkboxes | text | textarea | ) |
allow_other | yes | bool |
##Helper Functions #####get_custom_field_by( $field, $value ); This fetches the custom fields based on get_customfields, using prefetched or cached if available and returns a single field.
argument | required? | datatype |
---|---|---|
field | yes | string ( field_id | name | display_as ) |
value | yes | string |
Returns custom field as array or false. |
#####get_custom_field_type( $field, $value );
argument | required? | datatype |
---|---|---|
field | yes | string ( field_id | name | display_as ) |
value | yes | string |
Returns field type as string, or false. Possible values are select , radio , checkboxes , text , textarea
|