-
-
Save jessijean/7223626 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Gets a single value. | |
* The first value if field group is repeatable | |
* | |
* @param string $field_slug | |
* @param int $post_id ID of post or null to use current post in loop | |
* @param array $options Array or query string of options to send to field type | |
* @return mixed string or array, depending on the field type | |
*/ | |
function simple_fields_value($field_slug = NULL, $post_id = NULL, $options = NULL) { | |
/** | |
* Gets all values as array | |
* @param string $field_slug or comman separated list of several slugs | |
* @param int $post_id ID of post or null to use current post in loop | |
* @param array $options Array or query string of options to send to field type | |
* @return mixed string or array, depending on the field type and if first arg contains comma or not | |
* | |
* Example output if field_slug contains comma = get serveral fields from a repeatable field group | |
* Array | |
* ( | |
* [0] => Array | |
* ( | |
* [image] => 1156 | |
* | |
[text][/text]=> Text 1 | |
* [link] => /hej/ | |
* ) | |
* | |
* [1] => Array | |
* ( | |
* [image] => 1159 | |
* | |
[text][/text]=> Hej svejs i ditt fejs | |
* [link] => /hopp/ | |
* ) | |
* | |
* Example output if field_slug with no comma: | |
* Array | |
* ( | |
* [0] => Text 1 | |
* [1] => Hej svejs i ditt fejs | |
* [2] => Lorem ipsum dolor sit amet | |
* ) | |
*/ | |
function simple_fields_values($field_slug = NULL, $post_id = NULL, $options = NULL) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment