Did you try Is user… section in CCS doc?
[Updt] Ah, just tried, CCS ACF Repeater shortcode doesn’t return data for user…
[Updt] Curious, checking if the user repeater has values returns a positive result (“Repeater data found”) but then, the repeater shorcode doesn’t return any data:
[if user_field=my_user_repeater]
<p>Repeater data found</p>
[repeater my_user_repeater]
[user my_user_repeater_text]<br>
[/repeater]
[else]
<p>No repeater data found</p>
[/if]
-
This reply was modified 1 year, 2 months ago by
studioavanti.
-
This reply was modified 1 year, 2 months ago by
studioavanti.
-
This reply was modified 1 year, 2 months ago by
studioavanti.
I guess there’s a bug with ACF Repeater in user’s page.
Maybe it would require a fix and a parameter to pass to the Repeater shortcode as for Option page(?)
[repeater field_name option=true]
[field inner_field]
[/repeater]
We can also make a custom shortcode, based on this article.
I tried quickly, it works:
https://support.advancedcustomfields.com/forums/topic/repeater-field-shortcode/#post-126160
function acf_repeater( $atts ) {
extract( shortcode_atts( array (
'field' => 'field',
'subfield1' => 'subfield1',
), $atts ) );
$user_id = get_current_user_id();
ob_start();
if( have_rows( $field,"user_{$user_id}" ) ):
while ( have_rows( $field, "user_{$user_id}" ) ) : the_row();
// vars
$subfieldname1 = get_sub_field( $subfield1 );
echo $subfieldname1; ?><br>
<?php endwhile;
endif;
$output = ob_get_clean();
return $output;
}
add_shortcode('acf_repeater_shortcode', 'acf_repeater');
usage: [acf_repeater_shortcode field=’my_user_repeater’ subfield1=’my_user_repeater_text’]