Home › Forums › General Issues › Count total amount of flexible content used? › Reply To: Count total amount of flexible content used?
Thanks everyone for the help but it didn’t work so I re-did everything by adding another flexible content field inside another flexible content field like this:
– IRL today data (flexible content)
– Website (flexible content)
– Image
– Social (flexible content)
– Text field
Now I’m trying to find a way to count items inside an array. For example, when I run a print_r:
<pre>
<?php print_r(get_field('irl_today_entry', $post_id));?>
</pre>
It prints out:
Array
(
[0] => Array
(
[acf_fc_layout] => irl_today_website_entry
[irl_today_website] => Array
(
[0] => Array
(
[acf_fc_layout] => irl_today_img_website
[image_of_website] => http://soundboard.local/wp-content/uploads/2019/09/FireShot-Capture-003-Apple-Google-Pull-Hong-Kong-Protest-Apps-Amid-China-Uproar-WSJ_-www.wsj_.com_.png
)
[1] => Array
(
[acf_fc_layout] => irl_today_img_website
[image_of_website] => http://soundboard.local/wp-content/uploads/2019/09/FireShot-Capture-005-Apple-CEO-Tim-Cook-defends-decision-to-remove-an-app-used-by-Hong-Kon_-www.cnn_.com_.png
)
)
)
[1] => Array
(
[acf_fc_layout] => irl_today_social_entry
[irl_today_social] => Array
(
[0] => Array
(
[acf_fc_layout] => irl_today_social_media
[social_media_network] => twitter
[social_media_username] => randouser
[text_of_social_media] => text removed
[url_to_social_media_post] =>
[social_media_date_published] =>
)
[1] => Array
(
[acf_fc_layout] => irl_today_social_media
[social_media_network] => twitter
[social_media_username] => randouser
[text_of_social_media] => text removed
[social_media_date_published] =>
)
)
)
)
How do I count the items in [irl_today_social] without using any number?
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.