Support

Account

Home Forums ACF PRO Auto List Group Filed

Helping

Auto List Group Filed

  • 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));

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Auto List Group Filed’ is closed to new replies.