Support

Account

Home Forums General Issues Cannot get Group values from backend

Helping

Cannot get Group values from backend

  • Hi, I’m facing some problems trying to retrieve group values with php.
    First of all, I’m quite a newbie in php but not in programming in general.

    So, let’s start with what I’m trying to achieve.
    I’d like to let a customer write numbers in a custom field that I will write into a hard-coded html+css table. I’m using Snippets plugin to inject php code.

    The setup is the following:
    – Dress
    – Waist measures
    – 40 -> 123cm
    – 42 -> 456cm
    – …
    – Other measure
    – 40 -> 123cm
    – 42 -> 456cm

    I ‘ve tried something, I’ll leave something below:

    $fields = ('group_6355671c9df5c');
    
    		if( $fields ){
    
    			foreach( $fields as $field ){
    			if( $field['value']){
    				echo('Value: ' . $field['value'] . '   ');
    					
    				$value = $field['value'];
    				if(is_array($value)) {
    					$value = @implode(', ', $value);
    					echo('Value: ' . $field['value'] . '   ');
    				}
    
    			}
    
    		}
    
    	}
    /*$rows = get_field('group_6355671c9df5c');
    	echo($rows['40']);
    	$rows = get_field('circvitapantaloni');
    	echo($rows['40']);*/

    Those are failed tests, that are incomplete maybe because I was deleting part and trying again, but I hope they can be helpful.

    Thank to everyone who will help me out.

  • I’m not sure what you are trying to do. You cannot get fields from an ACF field group the way you are trying to get them.

    You get fields, not field groups.

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

You must be logged in to reply to this topic.