Good evening, I’m sorry for English.
I have worked in a small CRM solution trying to automate the way the pages are built
Basically, in the user profile, list all forms that he has linked data.
And here it was okay. BUT….
I would like to organize my layouts with forms being displayed by their functions
So, I have two questions:
First:
Adding a custom field option in group settings?
Second:
How to recover the information saved in the settings field group?
I got here, but I need help to interpret the information returned:
// Get data from post
$postmeta = get_post_meta( 35 );
print_r($postmeta);
echo '<br><br><br>';
// Get used fields in post
if (!empty($postmeta)){
$filter='field_';
foreach($postmeta as $metafields){
if(strpos($metafields[0],$filter)!==false){
$usedfileds[] .= $metafields[0];
}
}}
print_r($usedfileds);
echo '<br><br><br>';
// Get Relational Meta
foreach($usedfileds as $filde){
global $wpdb;
$post = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type='acf-field'", $filde ));
$metaid[] .= $post;
}
print_r($metaid);
echo '<br><br><br>';
// GET ID GROUPS
foreach($metaid as $groupfield){
global $wpdb;
$groupid[] .= $wpdb->get_var( $wpdb->prepare( "SELECT post_parent FROM $wpdb->posts WHERE ID = %s", $groupfield ));
}
print_r($groupid);
$groupid = array_unique($groupid);
echo '<br><br><br>';
// GET Groups option
foreach($groupid as $groupa){
global $wpdb;
echo $groupa = $wpdb->get_var( $wpdb->prepare( "SELECT post_content FROM $wpdb->posts WHERE ID = %s", $groupa ));
}
print_r($groupa);
Thank you in advance any help and grateful for any suggestion.
Hi @felipeost
Could you please explain your first question in more detail? Maybe you can post some screenshots?
Regarding the second question, maybe this code is what you want?
print_r(acf_get_fields(35));
The topic ‘Auto List Group Filed’ is closed to new replies.
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.