php - 转发器 ACF 子域的计数
问题描述
我想计算转发器 ACF 的子字段的数量作为我的代码
<?php
$cards = get_sub_field('agence_post');
if(have_rows('agence_post')):
$number_of_cards = count($cards);
echo $number_of_cards;
endif;
?>
解决方案
您好您可以使用此功能获取子字段
<?php $numrows = count( get_sub_field( 'agence_post' ) );
echo $numrows;?>