Okay so thats how you do it. http://www.advancedcustomfields.com/resources/functions/get_field_objects/
This worked for me to get fields’ labels and values based on the postid, but
Still not sure how to get the groupid from the post/page id.
Good Luck!
Actually I wonder if this is how we get the fields lables/values with post id, http://www.advancedcustomfields.com/resources/functions/get_field_objects/ ??? I use that but got bool(false)? Whats up?
I’m looking for this exact same thing. Currently I’m doing something like this, `<?php
//or insert the ID of your fields Group.
$groupID=’2480′;
$custom_field_keys = get_post_custom_keys($groupID);
$items = count($custom_field_keys);
foreach ( $custom_field_keys as $key => $fieldkey )
{
if (stristr($fieldkey,’field_’))
{
//echo $key . ” => ” . $fieldkey . “<br />”;
//echo $field[‘label’] . ‘: ‘ . $field[‘value’];
//echo $fieldkey . “<br />”;
$field = get_field_object($fieldkey, $groupID);
echo ‘<span class=”h4″>’ . $field[‘label’] . ‘</span><br /><span class=”sans”>’ . $field[‘value’]. ‘</span></p>’;
}
}
?>`
But would love to know how to get it from the post/page id.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.