simple_fields_fieldgroup

simple_fields_fieldgroup – Retrieve values from all fields in a field group.

This function works like a shortcut to running simple_fields_value(slugs) with all slugs already entered. Depending if the field group is repeatable or not, simple_field_value or simple_fields_values will be used.

Description

mixed simple_fields_value( string $field_slug [, int $post_id, mixed $options] )

Parameters

field_group_id_or_slug
The slug or the is of the field group that you want to get all field values for.

post_id
Id of the post to get values from. Defaults to the current post in the loop.

options
An optional set of options as array or query string to send to field type. This is a way to send options to the field type so it can modify values before return, or modify the output in any way. So far, only a few field types support options.

Return value

Mixed, but probably array, depending on how many field the group has (just one field, and not repeatable = no array for you!)

Example

$field_group_values = simple_fields_fieldgroup("myFieldGroupSlug);
print_r($field_group_values);

// Output of above (in this case information about a video)
Array
(
[video_url] => http://www.youtube.com/watch?v=eqnj19LDGqQ
[external_likes] => 3
[external_views] => 572
[date_uploaded] => 2012-01-06T04:45:45.000Z
[date_updated] => 2012-10-27T13:47:40.000Z
[youtube_title] => GoPro HD HERO2
[youtube_description] => Testing my new GoPro camera.
[youtube_duration] => 181
[youtube_comments] => 1
[youtube_thumbnail] => http://i.ytimg.com/vi/eqnj19LDGqQ/hqdefault.jpg
[video_location_lat] => 63.42393641810853
[video_location_lng] => 12.96202958164065
)

6 thoughts on “simple_fields_fieldgroup

  1. Chris

    How would i incorporate this into

    <?php

    $selected_value = simple_fields_get_post_value(get_the_id(), array(1,1), true);

    $theImageURL = wp_get_attachment_url($selected_value);
    echo '’;
    ?>

    to show multiple images from the 1 post connector

  2. Tim

    How do I output a repeatable fieldgroup (in other words echo it with all the values it holds) on a page? The above doesn’t really tell me. Thanks.

Leave a Reply