Hello,
I have a flexible content field with subfields. I’m using this code to display subfields:
if (have_rows('fcf_name')) {
while(have_rows('fcf_name')) {
the_row();
echo get_sub_field('subfield_name'); //this echoes value for each flexible content item
}
}
Now let’s say I have multiple flexible content items. How can I add subfield values from multiple flexible content’s to an array. So If I have 3 flexible contents, an array with 3 values from subfields must be created.
Regards
Ah, so simple…
if (have_rows('fcf_name')) {
while(have_rows('fcf_name')) {
the_row();
$array[] = get_sub_field('subfield_name');
}
print_r($array);
}