I'm creating an event page where we can add an event line-up. Such a line-up consists out of different speakers.
So I've create two custom post types:
- Line-up
- Speaker
On my event page you can select the created line-up. A repeater is used to add speakers (speaker post objects) to a specific line-up.
On my event page:
<?php
/*
* get the ID of the selected line-up
*/
$line_up = get_sub_field('line-up');
$line_up_id = $line_up->ID;
?>
<?php
/*
* Looping over the speakers repeater within the selected line-up
*/
if( have_rows('speakers', $line_up_id) ):
while( have_rows('speakers') ) : the_row();
$speaker_obj = get_sub_field('speaker_object');
$speaker_time = get_sub_field('speaker_time');
var_dump($speaker_obj); // there is no output
endwhile;
endif;
?>
But there is no output.
$line-up
is not valid PHP. Try replacing them with underscores and see if that resolves the issue.have_rows()
call is missing the$line_up_id
, so that might be the cause to the issue. But if not, then you should ask on SO or an ACF support forum/site for further help/insights.