Answer the question
In order to leave comments, you need to log in
How to display sub_field ACF value?
I set up the contents of the columns in the admin panel (I display additional ACF fields).
If I just have extra. field (the_field) - then everything is displayed normally, but if I have a nested field, then the value of the field is not displayed. What could be the problem?
case 'data_starta' :
$start = the_sub_field( "date_start", $post->ID );
if ( empty( $start ) )
echo __( 'Не указана' );
else
printf( $start );
break;
<?php if ( have_rows( 'data_raspisanie_grafik' ) ) : ?>
<?php while ( have_rows( 'data_raspisanie_grafik' ) ) : the_row(); ?>
<?php the_sub_field( 'date_start' ); ?>
<?php the_sub_field( 'duration' ); ?>
<?php the_sub_field( 'end_date' ); ?>
<?php the_sub_field( 'schedule' ); ?>
<?php endwhile; ?>
<?php endif; ?>
Answer the question
In order to leave comments, you need to log in
Here it worked:
case 'data_starta' :
if ( have_rows( 'data_raspisanie_grafik' ) ) :
while ( have_rows( 'data_raspisanie_grafik' ) ) : the_row();
$start = get_sub_field( "date_start", $post->ID );
if ( empty( $start ) )
echo __( 'Дата не указана' );
else
printf( $start );
endwhile;
endif;
break;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question